audiofile = File.createTempFile(file_name, ""+audio_format, sampleDir);
String path=Environment.getExternalStorageDirectory().getAbsolutePath();
audioSource = MediaRecorder.AudioSource.MIC;
recorder=new MediaRecorder();
recorder.setAudioSource(audioSource);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(audiofile.getAbsolutePath());
//recorder.prepare();
//recorder.start();
//Handle IOException
recorder.prepare();
recorder.start();
Log.d("TAG", "recording started");
该代码在 android2.3 上完美运行,但在 4.0 上无法运行它在 recorder.start() 上给出错误,我对此完全空白任何与之相关的建议都将被接受,在此先感谢