How do I kill an Android thread completely?

后端 未结 5 439
灰色年华
灰色年华 2020-12-03 01:20

I have a service that has its own thread running on background. I\'d like to kill that service including the thread.

I created the thread like this and run it.

5条回答
  •  生来不讨喜
    2020-12-03 01:50

    The method Thread.stop() is deprecated, you can use Thread.currentThread().interrupt(); and then set thread=null.

提交回复
热议问题