Ii. SoundRecorder class Introduction
First, we will introduce the RemainingTimeCalculator class. It is responsible for calculating the number of Recording files that can be stored in the remaining storage space of the storage media. The timeRemaining () function is used to calculate the remaining time and calculate the remaining time based on the smaller limit on the file size and space size.
MCurrentLowerLimit = result <result2
? DISK_SPACE_LIMIT: FILE_SIZE_LIMIT;
The SoundRecorder class is an Activity. This class is responsible for implementing all the parts displayed to the user, including the interface and response to various operations. Recording, recording storage, and playback functions are implemented by calling methods in the Recorder class. The SoundRecorder contains the mRecorder object of a Recorder class.
As a subclass of the Activity class, SoundRecorder reloads multiple functions of the parent class:
OnCreate () onDestroy () (from startup to full destruction)
OnStart () onStop () (from visible to invisible)
OnPause () (from operable to unoperable)
These functions include the operations required for Activity switching between different States. The status switching here is caused by the influence of the SoundRecorder program, such as sleep on the mobile phone, program suspension, and switching from SoundRecorder program to other programs.
In addition, SoundRecorder also loads several functions:
OnConfigurationChanged (); when switching between landscape and landscape screens, refresh the UI.
OnSaveInstanceState (Bundle outState); saves the Recorder state to the Bundle. Actually, the saveState () function mentioned above is called. When the SoundRecorder needs to be interrupted for some reason, the status is saved, and then the corresponding code in onCreate () reads the status value in the Bundle at the restart to return the status of the program before the interruption, actually, the restoreState () function mentioned above is called.
OnPrepareOptionsMenu (), onOptionsItemSelected (), the two functions are responsible for implementing the menu key function.
From LuoXianXiong, your partner