Code example for MediaRecorder: Recording audio and video

Methods: preparesetAudioChannelssetAudioEncodersetAudioEncodingBitRatesetAudioSamplingRatesetAudioSourcesetOutputFilesetOutputFormatstart

0
	    regtooth.mkdir();
	    File dir=new File("mnt/sdcard/RegTooth/"+this.nome);
	    dir.mkdir();
	    regtooth.getParentFile();
 
		recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
		recorder.setOutputFormat(this.formato);
		recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
		recorder.setAudioChannels(qual); 				//1 mono - 2 stereo
		recorder.setAudioEncodingBitRate(8 * qual);   	//BIT
		if(qualita.charAt(13) == '4'){					//BIT RATE
		recorder.setAudioSamplingRate(44100);
		}else recorder.setAudioSamplingRate(96000);
	    rec=new File("mnt/sdcard/RegTooth/"+this.nome);
	    direc="mnt/sdcard/RegTooth/"+this.nome;
	    recorder.setOutputFile("mnt/sdcard/RegTooth/"+this.nome+path);
		try { 
			recorder.prepare();
		} catch (IOException e) {
			Log.e(LOG_TAG, "prepare() FALLITO");
		} 
		recorder.start();
	} 
 
	public void stop() throws IOException { 
		recorder.stop();
		recorder.release();
Connect your IDE to all the code out there  Get Codota for Java