What Happens To This Thread Runnable At The End Once It Is Completed?
I have this thread which downloads a few images from the server. So once it downloads the images I call the handler and carry on UI updation. So since stop() for thread is deprecat
Solution 1:
The thread will end and die on its own. You don't have to end it yourself. You won't be able to restart it without creating a new Thread
object. The garbage collector will handle whatever memory needs to be release. The object will stay in memory as long as you hold a reference to it. Remove the reference, and the garbage collector will remove the object just like any other.
Solution 2:
You should look into the ExecutorService and Executors.
If its the same as regular Java then it provides some powerful thread management including shutting down all the threads at once.
Post a Comment for "What Happens To This Thread Runnable At The End Once It Is Completed?"