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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:34:24+00:00 2026-05-23T07:34:24+00:00

Here I want to show a second dialog box after first dialog box disappears.I

  • 0

Here I want to show a second dialog box after first dialog box disappears.I am showing the first one for 5000ms, how can we do this?

Thanks in advance…!

 Button signin = (Button) findViewById(R.id.regsubmitbtn);

signin.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
        showDialog(0);
        t = new Thread() {
            public void run() {
                register();
                try {
                    Thread.sleep(5000);
                    removeDialog(0);

            e.printStackTrace();
        }
            }
        };
        t.start();
    }
});
   @Override
  protected Dialog onCreateDialog(int id) {
   switch (id) {
    case 0: {
    dialog = new ProgressDialog(this);
    dialog.setMessage("Registering...");
    dialog.setIndeterminate(true);
    dialog.setCancelable(true);
    return dialog;
}
}
return null;
} 
  • 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-23T07:34:24+00:00Added an answer on May 23, 2026 at 7:34 am

    create a counter which will make a count for how many times the dialog is created and then create a handler through which you will send message whether to show dialog or dismis.

    See the following code. It does exactly what you want

    Example

    import android.app.Activity;
    import android.app.Dialog;
    import android.app.ProgressDialog;
    import android.os.Bundle;
    import android.os.Handler;
    import android.os.Message;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.Button;
    
    public class Main extends Activity{
    
        Button btn = null;
        ProgressDialog dialog = null;
        int counter = 0;
        Thread t =null;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.myxml);
    
        btn = (Button) findViewById(R.id.btn001);
        btn.setOnClickListener(new OnClickListener() {
    
            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
    //          tv.setHint(tv.getHint());
    //          while(counter<2){
    
                t = new Thread() {
                    public void run() {
    //                  register();
                        try {
                            while(counter<2){
                            updateGallery(0);
                            Thread.sleep(5000);
    
                            updateGallery(1);
                            Thread.sleep(1000);
    
                            }
    
                }catch(Exception ex){
                    ex.printStackTrace();
                }
                    }
                };
                t.start();
    
                }
    //          tv.setTextColor(getResources().getColor(R.color.DarkBlue));
    //      }
        });
    
    
    
    //  tv.setFreezesText(true);
    }
    
    
    
    
    @Override
    protected Dialog onCreateDialog(int id) {
     switch (id) {
      case 0: {
    
          ++counter;
      dialog = new ProgressDialog(this);
      if(counter==1){
      dialog.setMessage("Registering...");
      }else{
          dialog.setMessage("Registered successfully");
      }
      dialog.setIndeterminate(true);
      dialog.setCancelable(true);
    
    }
    
    }
     return dialog;
    }
    
    public void updateGallery(int actionsToBePerformedOnScreen) {
        Message msg = new Message();
        msg.what = actionsToBePerformedOnScreen;
        galleryListHandler.sendMessage(msg);
    
    }
    
    public Handler galleryListHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
            case 0:
    
                showDialog(0);
    
                break;
    
            case 1:
                // clear all images in the list
                removeDialog(0);
                break;
    
    
            }
    
        };
    };
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to achieve hide/show with div's in html but in this way. Here
In my application I want to show the the Dialog-box when press the back
ProgressDialog onClick not working.. here is my code .. Basically i want to show
Here i want to do UDP Socket programming in C. I have one device
I'm not entirely sure if I can do what I want here, but I
To explain my question I have created this http://jsfiddle.net/Jams/XNVB2/ here I want when div1
Possible Duplicate: Android: ProgressDialog.show() crashes with getApplicationContext I want to have a progress dialog
I want to create a input dialog box when new record is created and
I want to show the waiting dialog but it doesn't show at all, which
I want to change first view in portrait mode and the second view comes

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.