java.lang.IllegalStateException at android.media.MediaRecorder.start(Native Method)

前端 未结 5 2057
别那么骄傲
别那么骄傲 2021-01-14 12:22

I want to make a voice recorder app but it crashes when i click the \"Start Recording\" button. I get an error saying java.lang.IllegalStateException at android.media.Media

5条回答
  •  半阙折子戏
    2021-01-14 13:01

    `if (audioRecorder != null) {
                try {
                    audioRecorder.stop();
                    audioRecorder.reset();
                    audioRecorder.release();
                    audioRecorder = null;
                    
                } catch (IllegalStateException e) {
                    e.printStackTrace();
                }
            }`
    

    Because we are not releasing recorder and only stopping the recorder on relaunch we get at android.media.MediaRecorder.start(Native Method) took 1 hrs to figure out

    HappyCoding

提交回复
热议问题