Posts

Showing posts with the label runnable

removeCallbacks not stopping runnable

removeCallbacks not stopping runnable I am calling from a method: myHandler.postDelayed(mMyRunnableHide, 6000); which calls: public Runnable mMyRunnableHide = new Runnable() { public void run() { mTextDisplay.setText(""); DisplayX(); } }; if a button on screen is clicked I want to stop the runnable: Button next = (Button) findViewById(R.id.Breaction); next.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { myHandler.removeCallbacks(mMyRunnableHide); mTextDisplay.setText(""); DisplayX(); } }); } the removecallbacks is not stopping the runnable. What am I doing wrong? Am I using the correct method? I just want the runnable to "Not Run" when the user clicks the button. Thanks for any help. @YekmerSimsek Runnable class has no stop() method. – joao2fast4u Oct 24 ...