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

  • Home
  • SEARCH
  • 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 4580688
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:49:06+00:00 2026-05-21T20:49:06+00:00

i m newcomer in android. i am faceing some trouble my Scenarios is -when

  • 0

i m newcomer in android.
i am faceing some trouble
my Scenarios is -when i click button so open alertDailog and alertdailog have two button like send and cancel,when i click send button, i wanna to open a ProgressBar because send button have havy content, so take more time.

i m using handler but not found any exact solution

i m using this code

btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {

                handler.sendEmptyMessage(0);

        }

    });
  alert = new Dialog(ProgramDetailActivity.this);

        alert.setContentView(R.layout.dialog_email);
        alert.setTitle("                   Enter mail info");
        alert.setCancelable(true);
        new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog,
                    int id) {
                finish();
            }
        };
             btnSend = (Button) alert.findViewById(R.id.btnsend);
         btnBack = (Button) alert.findViewById(R.id.btncancel);

        alert.show();

btnSend.setOnClickListener(new View.OnClickListener() {

            @SuppressWarnings("null")
                         public void onClick(View v) {
                        handler2.sendEmptyMessage(0);

// perform long opration
progressDialog.dismiss();

                         toast=Toast.makeText(ProgramDetailActivity.this,"Mail has been sent Sucessfully!",

Toast.LENGTH_LONG);
toast.show();

}
}

private Handler handler2 = new Handler() {
public void handleMessage(Message msg) {
alert.hide();
alert.cancel();
alert.dismiss();

progressDialog = ProgressDialog.show(v.getContext(),                                "Email Sending", "Please wait...");
    }
};
  • 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-21T20:49:07+00:00Added an answer on May 21, 2026 at 8:49 pm

    I have also used Progressdialog in click event of Alertdialog.The code is below:

    AlertDialog.Builder submitalert = new AlertDialog.Builder(Summary.this);
     submitalert.setTitle(getResources().getString(R.string.app_name))
    .setMessage("Submit the data to database?")
    .setPositiveButton("Yes", new DialogInterface.OnClickListener(){
    
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // TODO Auto-generated method stub
                        update.setTitle(getResources().getString(R.string.app_name));
                        update.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
                        update.setCancelable(true);
                        update.setMax(100);
                        update.show();
    
    
                        Thread background = new Thread (new Runnable() {
                               public void run() {
                                   try {
                                       // enter the code to be run while displaying the progressbar.
                                       //
                                       // This example is just going to increment the progress bar:
                                       // So keep running until the progress value reaches maximum value
                                       while (update.getProgress()<= update.getMax()) {
                                           // wait 500ms between each update
                                           Thread.sleep(500);
    
                                           // active the update handler
                                           progressHandler.sendMessage(progressHandler.obtainMessage());
                                       }
    
                                   } catch (java.lang.InterruptedException e) {
                                       // if something fails do something smart
                                   }
                               }
                            });
    
                            // start the background thread
                            background.start();
                            if(update.getProgress()== 100)
                               {
                                   update.dismiss();
                               }
                        }
    
    
    
    
                })
                .setNegativeButton("No", new DialogInterface.OnClickListener(){
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // TODO Auto-generated method stub
    
                    }
                })
                .show();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a newcomer to PDO and have to say that I like it so
I'm a newcomer to subversion. Recently, I've done some development in two different branches,
i m newcomer in android. when i send request to server , to retrieve
I am new android and I would appreciate some help. I have this code:
I am a newcomer to Silverlight and while I have been following some tutorials
I am a newcomer to TDD. What are some of the techniques you guys
I'm a newcomer to Rails, and have been following the tutorial on the rails
I am a Javascript/jQuery/Prototype newcomer and I have a page that has a Prototype
I am a new comer in Android development, I have downloaded and installed the
I'm newcomer in django, and here is question: I have model class: def Client(models.User)

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.