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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:47:17+00:00 2026-06-08T01:47:17+00:00

Seems there is several variations on this theme. I display an AlertBox to the

  • 0

Seems there is several variations on this theme. I display an AlertBox to the user do want to save this item out? If they respond OK then I want the Alertbox to go away to be replaced by ProgressDialog box then when item is done being saved out it dismisses.

The current code below shows the Ok/Cancel AlertBox and dismiss properly and shows toast correctly. But if the user selects OK the ProgressDialog shows after all is completed and never goes away. The OK/Cancel button stays depressed until item is saved. If the user presses OK I want the AlertBox to go away and then display the ProgressDialog and dismiss it when done saving.

{
 Vibrate(ClickVibrate); 
 final ProgressDialog Dialog = ProgressDialog.show(v.getRootView().getContext(), "Loading", "Please wait...", true);
if(AlertDialogProcessing==0)
{    
ProgressDialog progress;  
final String title="Save Item";
final String message="Press OK to save or CANCEL.";
final String ok="OK";
final String cancel="CANCEL";

final AlertDialog.Builder alertbox = new AlertDialog.Builder(this);
alertbox.setCancelable(true);
alertbox.setIcon(android.R.drawable.ic_dialog_alert);
alertbox.setTitle(title);
alertbox.setMessage(message);
alertbox.setNegativeButton(cancel, null);

final AlertDialog dlg = alertbox.create();

 alertbox.setPositiveButton(ok,new DialogInterface.OnClickListener()
   {  
     public void onClick(DialogInterface arg0, int arg1)
     {  
      dlg.dismiss();
      Dialog.show();
      Vibrate(ClickVibrate); 
      Drawable drawable= getItem(imageSelect);   
      AlertDialogProcessing=1;   
      //task that takes 3 seconds
      AlertDialogProcessing=0;
      Toast.makeText(getApplicationContext(), "Item Saved.", Toast.LENGTH_LONG).show();   
    } 
  });
 alertbox.setNegativeButton(cancel,new DialogInterface.OnClickListener(){ public void onClick(DialogInterface arg0, int arg1){AlertDialogProcessing=0; Vibrate(ClickVibrate); } });
 alertbox.show();
 }
 Dialog.dismiss();
}
  • 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-08T01:47:19+00:00Added an answer on June 8, 2026 at 1:47 am

    You’re calling both ProgressDialog.show() and ProgressDialog.dismiss() inside the positive button’s onClick(), no wonder the ProgressDialog doesn’t show. If the saving process takes some time such that you need a ProgressDialog, I’d strongly recommend using the AsyncTask class. It runs a task on a worker thread and gives you a possibility to update the UI with the current task progress. Hope this helps.

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

Sidebar

Related Questions

There seems to be many variations of this question, but none that deal with
Seems like there are several ways to do this. I've found to use HttpContext.Current.Request.UserAgent
There seems to be lots of great Object Relational Mappers out there - several
It seems that there are several really fast prime factorization algorithms around (one that
It seems there are many ways to do this, however, none of them make
There seems to be several technology demos such as http://rails-primer.appspot.com/ on how to run
There are several questions throughout this post all related to the title. The overall
There are several packages out there that help in automating the task of writing
When I use the __FUNCTION__ macro/variable to print out debugging information, there seems to
There are several properties on List<T> that seem to be related to number of

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.