この問題は、Motorolaマイルストーンでのみ発生します。コード:
// init recorder
recordInstance = new AudioRecord(MediaRecorder.AudioSource.MIC,
8000, AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT, 8000);
recordInstance.startRecording();
//more code here
recordInstance.stop();
私が持っているエラー情報(デバッグのためのマイルストーンを自分で持っていないので、今のところこれ以上見つけることができません):
Uncaught handler: thread main exiting due to uncaught exception
java.lang.IllegalStateException: stop() called on an uninitialized AudioRecord.
at android.media.AudioRecord.stop(AudioRecord.java:51 6)
明らかに、この問題を抱えているのは私だけではありません。私が見つけたいくつかの非常によく似たスレッド(解決策なし):
http://groups.google.com/group/android-developers/browse_thread/thread/6dd24aeb484b2e40 http://web.archive.org/web/20100824043744/http://androidcommunity.com:80/forums/f2/problem -using-audiorecord-in-motorola-milestone-30935 / http://community.developer.motorola.com/t5/Android-App-Development-for/Problem-using-AudioRecord-on-Milestone-device/mp/3889 http://www.fring.com/forums/showthread.php?t=16194 http://groups.google.com/group/android-developers/browse_thread/thread/63be273ba59c635e/1c4a010fd470d328