Name the Thread of an AsyncTask

前端 未结 2 1923
执念已碎
执念已碎 2020-12-17 08:10

Is it possible to give a name to an AsyncTask\'s background thread, as for normal Threads in Java:

Thread(Runnable target, String name) 

I

2条回答
  •  囚心锁ツ
    2020-12-17 08:57

    Try calling this from inside doInBackground():

    Thread.currentThread().setName("some custom name");
    

提交回复
热议问题