I want to save a recording made in the first activity and then play back the recording in the second activity in my Android App. I think I have everything but I cant seem to find a way to save in the first activity and then be able to access it in the second activity.
Right now, the application crashes because it cant find the file. I will include parts of the first and second activity for review.
This is from the first Activity where the file path is set
try{
Log.i(log_tag,"Setting the recorder");
speaker_recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
speaker_recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
speaker_recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
speaker_recorder.setOutputFile(getFilesDir().getAbsolutePath() + "/audio_test.3gp");
} catch(Exception e){
Log.e(log_tag,"Recording Settings Failed");
createTempFile("Status.txt", "COMPLETED-RECORDER FAILED");
}
//Prepare the Recorder
try{
Log.i(log_tag,"Preparing the Recorder");
speaker_recorder.prepare();
} catch(Exception e){
Log.e(log_tag,"Recording failed");
createTempFile("Status.txt", "COMPLETED-RECORDER FAILED");
exit_function();
}
This is from the Second Activity where the file is played back
private void playSound(boolean speakers) {
mContext = getApplicationContext();
mFile = "files" + "/audio_test.3gp";
audioManager.setSpeakerphoneOn(true);
try {
mp.setDataSource(mFile);
} catch (IOException e) {
e.printStackTrace();