How to stop Handler Runnable?

前端 未结 4 2030
半阙折子戏
半阙折子戏 2020-12-24 07:13

I am using a handler in the following program and I want to stop it when i=5 but the handler doesn\'t stop and run continuously.

   b1.setOnClickListener(ne         


        
4条回答
  •  一个人的身影
    2020-12-24 07:34

    protected void onStop() {
        super.onStop();
        handler.removeCallbacks(runnable);
    }
    

    you can stop it like this

提交回复
热议问题