How to limit record time with AudioRecord as MediaRecorder with setMaxDuration

android, android-audiorecord, audiorecord

Solution

You can try like this..

handler=new Handler();
 Runnable r=new Runnable() 
{
 public void run() 
{
  recorder.stop();
   recorder.release(); 
  } 

};
handler.postDelayed(r, 120000);

Problem

I need to stop AudioRecord after 2 minutes from the starting time. With MediaRecorder I use setMaxDuration and this work well, but I need a good approach with AudioRecord too. Thank's for help

Original source

Related problems