• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps How to create sdcard in emulater to save recorded file??

ambblr108

Lurker
Oct 1, 2012
4
0
Hi all,
i am beginner in android development.i am trying to recording on button click.

mycode is following::
HTML:
private void StartAudioRecording() {
		File sampleDir=Environment.getExternalStorageDirectory();
		try {
			audioFile=File.createTempFile("sound","3gp",sampleDir);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
		recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
		recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
		recorder.setOutputFile(audioFile.getAbsolutePath());
		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();
	}


when i was runnig applicayion in debug mode application getting crash.pls tell me what is wrong in this code.....
iam not getting sdcard path .

pls help me how to sove my issue.

thanks in advance
Ambrish Singh
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones