Is this a prefect way to stop handlerthread?

后端 未结 4 1971
你的背包
你的背包 2020-12-31 08:35

I always create two handler: one is wraping on main thread, another is wraping on a single thread.

Is this a best method to start and stop these in an Activity lifec

4条回答
  •  不知归路
    2020-12-31 09:18

    I have been following this :

    if (safeHandler!= null) {
         final Looper looper = safeHandler.getLooper();
         looper.quitSafely();
         safeHandler = null;
     }
    

提交回复
热议问题