I\'m creating a recording voice app, when I\'m trying to stop recording the Debug Console in java says that: \"MediaRecorder stop called in an invalid state : 4\" Here is
private void stopRecording() {
if (null != recorder){
try {
recorder.prepare(); <-- Here's the problem
You should not be calling prepare
when you're stopping the MediaRecorder
. The prepare
method is something you call prior to starting the recorder. Refer to the state diagram in the MediaRecorder
documentation.