Stop handler.postDelayed()

前端 未结 4 1429
被撕碎了的回忆
被撕碎了的回忆 2020-11-29 21:00

I call multiple Handlers by new Handler().postDelayed(new Runnable()..... How can I stop it when I click on back?

public class MyActivity extends AppCompatA         


        
4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-29 21:12

    this may be old, but for those looking for answer you can use this...

    public void stopHandler() {
       handler.removeMessages(0);
    }
    

    cheers

提交回复
热议问题