Well I can start the thread when I press togglebutton to ON and it works fine, that thread is to start audiorecord and audiotrack.
But I cannot stop the thread when I put togglebutton OFF… because I cannot do thread.stop… What I want to do is just stop audiorecord and audiotrack… If there is any way to start/stop them w/o making thread will be also fine.
Also, as I cannot stop thread, when I do togglebutton ON – OFF – ON, it makes an error because can’t start a thread 2 times.
Well I can start the thread when I press togglebutton to ON and it
Share
The
stop()method of Thread has been Deprecated (because it inherently unsafe) and java provides an alternative way to stop a Thread. Its a very simple approach, as described in this official link:http://docs.oracle.com/javase/1.4.2/docs/guide/misc/threadPrimitiveDeprecation.html
Did you try making the
isRecordingvariable global and then altering its state: