Hello everyone,
I want to know that when the Thread is running then if I press the home key of the emulator/device, then what will happen? Will thread gone be close or pause or any other?
waiting for your quick reply.
BR, gsmaker
Hello everyone,
I want to know that when the Thread is running then if I press the home key of the emulator/device, then what will happen? Will thread gone be close or pause or any other?
waiting for your quick reply.
BR, gsmaker
UI thread (Activity) will be paused and then stopped.
If you mean Thread
object runned from Activity then it will be continue running. It may cause various problems, so it will be better manually interrupt such threads.
If you want it running only if the Activity is visible, you'll have to call interrupt() on the Thread in onPause() and start the thread again in onResume(). Read something about interrupt (docs or Google), basically it throws InterruptedException in your thread but only if it's in waiting/sleeping state. What is your thread doing?