2
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)錯誤(,我對這個 任何建議完全空白提前MediaRecorder啓動失敗-2147483648工作2.3,但不是在4.0