Code example for AudioRecord

Methods: getRecordingStategetStatestartRecording

0
 
	/** 
	 * <p>Starts the recording, and sets the state to RECORDING.</p> 
	 */ 
	public void start() { 
		if (mRecorder.getState() == AudioRecord.STATE_INITIALIZED) {
			mRecorder.startRecording();
			if (mRecorder.getRecordingState() == AudioRecord.RECORDSTATE_RECORDING) {
				setState(State.RECORDING);
				new Thread() {
					public void run() { 
						while (mRecorder != null && mRecorder.getRecordingState() == AudioRecord.RECORDSTATE_RECORDING) {
							int status = read(mRecorder);
							if (status < 0) {
								break; 
							} 
						} 
					} 
				}.start();
			} else { 
				Log.e(LOG_TAG, "startRecording() failed");