我GOOGLE了一下,但没有找到任何解决办法
我记录呼入和呼出
code 工作正常呼出但是,来电提供的除了
记录=新MediaRecorder();
文件SD卡= Environment.getExternalStorageDirectory();
文件DIR =新的文件(sdCard.getAbsolutePath()+/ OK);
dir.mkdirs();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setOutputFile(Environment.getExternalStorageDirectory().getAbsolutePath()+"/OK/"+"yes"+".3gpp");
recorder.setAudioEn codeR(MediaRecorder.AudioEn coder.AMR_NB);
尝试 {
。录音机prepare();
recorder.start();
}赶上(IllegalStateException异常E){
Log.d(非法,e.toString());
}赶上(IOException异常E){
Log.d(IO,e.toString());
}
的logcat
1月2号至23号:43:08.346 11231-11231 / com.example.myapps.acr ** I /记录:启动**
一月二号至23日:43:08.426 11231-11231 / com.example.myapps.acr ** E / MediaRecorder:启动失败:-38 **
一月二号至23日:43:08.426 11231-11231 / com.example.myapps.acr ** D /非法:java.lang.IllegalStateException **
请帮忙为什么它不工作的来电。
解决方案 刻录prepare()。
视频下载(1000);
recorder.start();
有关来电它需要时间来prepare。
握住prepare 1秒钟,一切都正常工作。
I have googled about it but didn't find any solution
I am recording incoming and outgoing calls
code works fine with outgoing call but gives exception on incoming call
recorder = new MediaRecorder();
File sdCard = Environment.getExternalStorageDirectory();
File dir = new File(sdCard.getAbsolutePath() + "/OK");
dir.mkdirs();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setOutputFile(Environment.getExternalStorageDirectory().getAbsolutePath()+"/OK/"+"yes"+".3gpp");
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
try {
recorder.prepare();
recorder.start();
} catch (IllegalStateException e) {
Log.d("illegal",e.toString());
} catch (IOException e) {
Log.d("io",e.toString());
}
Logcat
02-23 01:43:08.346 11231-11231/com.example.myapps.acr **I/record﹕ start**
02-23 01:43:08.426 11231-11231/com.example.myapps.acr **E/MediaRecorder﹕ start failed: -38**
02-23 01:43:08.426 11231-11231/com.example.myapps.acr **D/illegal﹕ java.lang.IllegalStateException**
Please help why its not working on incoming calls..
解决方案recorder.prepare();
Thread.sleep(1000);
recorder.start();
For incoming call it was taking time to prepare.
Hold the prepare for 1 sec and everything is worked fine.
上一篇:尝试发送图像的Android应用程序崩溃应用程序、图像、Andr、oid
下一篇:在 C# Winforms 中,有没有办法在所有控件周围放置虚线边框,并在运行时选择特定控件时显示夹点?控件、虚线、并在、没有办法