Android AudioRecord - Won't Initialize 2nd time

前端 未结 5 1704
刺人心
刺人心 2020-12-31 08:52

Hej, im currently trying to get AudioRecord to work. Because I need it in a bigger project. But it seems to mess up a lot. I have been trying alot of things, so I went back

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-31 09:22

    I was able to reproduce your problem (on a Samsung phone). I added an onDestroy() method releasing the record:

    @Override
    public void onDestroy() { 
        super.onDestroy();
        System.out.println("OnDestroy");
        audRec.release();
    }
    

    After adding this, the audioRecord seems to initialize correctly every time the activity is started.

提交回复
热议问题