In my application the sound is recorded normally, except that I wanted to rename the recorded sound and then store it on the device.
outputFile = Environment.getExternalStorageDirectory().getAbsolutePath() + "/javacodegeeksRecording.3gpp";
myRecorder = new MediaRecorder();
myRecorder.setAudioSource (MediaRecorder.AudioSource.MIC);
myRecorder.setOutputFormat (MediaRecorder.OutputFormat.THREE_GPP);
myRecorder.setAudioEncoder (MediaRecorder.OutputFormat.AMR_NB);
myRecorder.setOutputFile (outputFile);
public void start(View view){ // começar a gravar
try {
myRecorder.prepare();
myRecorder.start();
//imglisten.setEnabled(false);
} catch (IllegalStateException e) {
// start:it is called before prepare()
// prepare: it is called after start() or before setOutputFormat()
e.printStackTrace();
} catch (IOException e) {
// prepare() fails
e.printStackTrace();
}
}
public void stop(View view){ //para de gravar
try {
myRecorder.stop();
myRecorder.release();
myRecorder = null;
//imglisten.setEnabled(true);
} catch (IllegalStateException e) {
// it is called before start()
e.printStackTrace();
} catch (RuntimeException e) {
// no valid audio/video data has been received
e.printStackTrace();
}
}
I wanted it to stop short, the save button could rename the recorded and stored sound. How can I do this?