Hi all,
i am beginner in android development.i am trying to recording on button click.
mycode is following::
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
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