アプリで声を録音して、それを res フォルダーに保存しようとしていました。そして、私は次のことをもっと少なくしました:
private MediaRecorder recorder;
static final String OUTPUT_FILE = "/MediaPlayer/res/raw/recordoutput.3gpp"; //MediaPlayer is the java class and raw is the folder that I would like to put my recorded voice in
private void beginRecording() throws Exception{
killMediaRecorder(); //I implemented this function to kill the existing recorder
File outFile = new File(OUTPUT_FILE);
if(outFile.exists())
{
outFile.delete();
}
recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(OUTPUT_FILE);
recorder.prepare();
recorder.start();
}
マニフェスト:
<uses-permission android:name="android.permission.RECORD_AUDIO" />
しかし、エミュレーターを実行した後、生の内部にファイルが作成されていません。誰か助けてもらえますか?