Code example for MediaRecorder: Recording audio and video

Methods: preparesetAudioChannelssetAudioEncodersetAudioEncodingBitRatesetAudioSamplingRatesetAudioSourcesetOutputFilesetOutputFormatstart

0
	    Button btn_stop = ((Button) findViewById(R.id.btnStop));
	    System.out.println(" ---- " + Environment.getExternalStorageDirectory() + " ---- ");
	    btn_start.setOnClickListener(new Button.OnClickListener(){
	    	public void onClick(View v) {
	    		System.out.println("======== start button");
	    		recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
	    	    recorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
	    	    recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
	    	    recorder.setAudioSamplingRate(16);
	    	    recorder.setAudioEncodingBitRate(96000);
	    		recorder.setAudioChannels(1);
	    	    recorder.setOutputFile(mUri);
				try { 
					recorder.prepare();
				} catch (IllegalStateException e) {
					// TODO Auto-generated catch block 
					e.printStackTrace();
				} catch (IOException e) {
					// TODO Auto-generated catch block 
					e.printStackTrace();
				} 
	    		recorder.start();
	    	} 
	    }); 
	     
	    btn_stop.setOnClickListener(new Button.OnClickListener(){
	    	public void onClick(View v) {