我已在我的应用程序中实现了录音功能。我能够录制音频并停止录制。但我无法恢复录音。
我试过录制音频的以下片段
recordIconImage.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
File parentFile = new File(Environment
.getExternalStorageDirectory(),
"/TafeRecordings/AudioRecordings/");
parentFile.mkdirs();
if (!parentFile.exists()) {
if (!parentFile.mkdirs()) {
Toast.makeText(getActivity(),
"Failed to create directory MyCameraImage.",
Toast.LENGTH_LONG).show();
Log.d("MyCameraVideo",
"Failed to create directory MyCameraImage.");
}
}
mediaFile = new File(parentFile.getPath(), "Audio" + ".3gp");
audioRecorder = new MediaRecorder();
try {
audioRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
audioRecorder
.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
audioRecorder
.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
audioRecorder.setOutputFile(mediaFile.getAbsolutePath());
audioRecorder.prepare();
audioRecorder.start();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
}
}
});