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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:48:01+00:00 2026-05-28T02:48:01+00:00

I want the dialog box to pop up after 5 seconds. Can someone explain

  • 0

I want the dialog box to pop up after 5 seconds. Can someone explain to me what I am doing wrong? Im getting an error in the Finish() section of the timer, (I’ve only been programmming for about three months now so please bear with my stupidity.

public void run() {
    CountDownTimer counter  = new CountDownTimer(5000,1000) {

        @Override
        public void onTick(long millisUntilFinished) {
            // TODO Auto-generated method stub

        }
        public void onFinish() {
            if (count == value) {
                AlertDialog.Builder lost = new AlertDialog.Builder(this);  //  <-----There is my error its telling me // to go and set up my dialog AlertDialog.Builder(new CountDownTimer(){}) {  And I dont understand it


                lost.setMessage("You lost! you are ugly!" +
                        "" +
                " new game?");
                lost.setCancelable(false);
                lost.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        clicks.setText("Clicks ");
                        count = 1;
                        generator = new Random();
                        value = generator.nextInt(100);
                        imgBtn.setImageResource(R.drawable.push);
                    }
                });
                lost.setNegativeButton("No", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        generator = new Random();
                        value = generator.nextInt(100);
                        ButtonMasherActivity.this.finish();
                    }
                });

                lost.create();
                lost.show();
            }
        }

    };
    counter.start();
}
  • 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-05-28T02:48:01+00:00Added an answer on May 28, 2026 at 2:48 am

    Try this :

    AlertDialog.Builder lost = new AlertDialog.Builder(ButtonMasherActivity.this);
    

    AlertDialog.Builder needs a Context object not a CountdownTimer object.

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

Sidebar

Related Questions

I want an alert dialog box to pop up after I click a button
I want to pop up a dialog box that says Saving... and once the
hii I want show a pop up Dialog box when i click on to
I want to get user input using a pop-up dialog box. I am able
On a menu item click, I want to pop a dialog box. private void
I want to close the dialog box when you click outside of the dialog,
I want to a create dialog box like window before displaying the console window.
I have jquery ui dialog box, and I want to resize it by the
I want it to have a popup dialog javascript box. Instead of a new
Mobile browsers. Jquery dialog alert box. I don't want to use alert() because it

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.