What happens to this thread runnable at the end once it is completed?

后端 未结 2 1822
眼角桃花
眼角桃花 2021-01-18 01:09

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 d

2条回答
  •  暖寄归人
    2021-01-18 01:36

    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.

提交回复
热议问题