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 8590159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:13:51+00:00 2026-06-11T23:13:51+00:00

I want to create a timer for the screen in an application to be

  • 0

I want to create a timer for the screen in an application to be frozen. Let’s say like two seconds. I don’t want the screen to react to any on screen button clicks. Is this “frowned” upon? Or is there another way of going about this.

My application:

enter image description here

User click:

enter image description here

I want to then pause everything for two seconds (so my other buttons listeners don’t go off) and then I want the listeners to go back, because I’ll turn the button back from green to grey.

  • 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-11T23:13:53+00:00Added an answer on June 11, 2026 at 11:13 pm

    In the click handler you could change the color and remove the onclick listener for all buttons and start a background thread that does your timing. When the background thread has slept for 2 minutes then you can add the onclick listeners back for all buttons. That way you don’t create a UI that is totally unresponsive, but you achieve the effect of disabling the buttons.

    public class myListener implements OnClickListener() {
      private boolean ignoreClicks = false;
    
      public void setIgnoreClicks( boolean b ) { 
        this.ignoreClicks = b;
      }
    
      @Override
      public void onClick( View v ) {
        if ( !ignoreClicks ) {
          // use v to get the button, then change the color
          ignoreClicks = true;
          // start a new AsyncTask and give it the listener and the view
          // in doInBackground sleep for 2 seconds
          // in onPostExecute change the color of the button back to normal
          //     (you have a reference to the button because you gave the view to the AsyncTask)
          //   and set ignoreClicks to false in the listener
        }
      }
    }
    

    Create one instance of this listener and use it for every button.

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

Sidebar

Related Questions

I want to create an incrementing second timer like a stopwatch. So I want
I just want to create an application with several functions. but i don't need
I want to create an application where there is a button and each time
I want to create a class that initializes a timer which will be used
I want some code to be triggered every second. Usually, I'd create a Timer
I have an application which has two Activities, let's call them A and B.
I am building a chat application for BlackBerry 4.6.0, and want to create a
How do I create a loading screen that can be reused at any given
I want to make a splash screen without creating multi-threading on the application does
I want to build an application with one main view that will be on-screen

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.