Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8995727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:39:29+00:00 2026-06-15T23:39:29+00:00

I am making an app and using handler. In class A, some buttons with

  • 0

I am making an app and using handler. In class A, some buttons with texts are displayed, and then using

handler.postDelayed(new Runnable(){@Override public void run() {blankbutton();}}, 10000); 

such that when passing 10sec the text on the buttons would be erased.

However, if the user at this time presses the reset button (in another class), say, after 3 sec after the handler counts time, then what will occur is that 7 sec after pressing reset the text on the button would be erased : the handler does not stop.

How could I stop the handler in another class (in the reset class)? I have checked some similar questions and answer for this is to

handler.removeCallbacks(Runnable);

However, under the reset class it says “Runnable cannot be resolved to a variable“

Many thanks!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:39:30+00:00Added an answer on June 15, 2026 at 11:39 pm

    Your issue is that you are making an anonymous inner Runnable object. You are leaving yourself no way to refer to it when you are trying to remove the callbacks. Something like this will make it work:

    Runnable txtClearRun = new Runnable(){
      public void run() {
        blankbutton();
      }
    };
    handler.postDelayed(txtClearRun, 10* 1000);
    .
    .
    .
    handler.removeCallbacks(txtClearRun);
    

    The difference is that this way you are assigning your runnable object to a variable txtClearRun so that you have a way to refer to it later when you want to pass it in to removeCallbacks();

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making an App using Adobe Flex/Air. I was wondering if there is any
I am in the middle of making an app using a PHP web service
I'm making a simple app using the HTML5 <canvas> tag and compile the code
I'm making an iOS app using AIR 3.1 and Flex 4.5.1, and if I
I'm making a mobile app using phonegap. That is to say, it's all done
So I am making a test app using RequireJs, Mustache and Backbone.js. I had
i m making APP which do image proceesing using java SE.i want to check
I'm making my slot machine app using iCarousel , my iCarousel contains images from
We recently built a web app using Prototype, making a fair amount of use
I'm using soci for making my app interact with databases and currently I use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.