I need to record audio using AudioRecord class for a specific time. Let’s say for 1 second. And then process the audio, and when the processing is done, record again for 1 second and keep repeating this until I close the program. What would be the best approach for this?
Share
Call this function once in
onCreate()and it will continue calling itself recursively until your activity is killed by the system.If you want to stop recursion when you press back or home button, then check a boolean inside the function before executing all the code in it. Set the boolean to false in your
onPause().