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

The Archive Base Latest Questions

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

I am using an AsyncTask to handle complex background operations (compiling a log file

  • 0

I am using an AsyncTask to handle complex background operations (compiling a log file to send) and I use a ProgressDialog to show the user progress. I have tried using showDialog() but it never seems to show or dismiss (it is never called), and I followed tutorials on how to do it…
So I am using unmanaged ones, and it won’t dismiss my message. I am also wanting to update the message as it starts to compile the log file (as it seems to lag there – or maybe the text view is just really long so it doesn’t update like it is supposed to).

I have moved my code around a bit so it look like there are problems (like onProgressUpdate()), but I don’t know how to make it work. I have looked around this site and nothing seems to be having the problem I am (not exactly anyways). RunOnUiThread() doesn’t work, new Thread(){} doesn’t work, and onProgressUpdate() I can’t get to work (the documentation is confusing on this).

It also never dismisses. I have set up a listener and it never dismisses.

Does anyone know what is wrong with my code? I thought AsyncTask was supposed to be simple.

        private class BuildLogTask extends AsyncTask<Void, Void, String> {
        String temp;
        ProgressDialog progressdialog = new ProgressDialog(context); //variable is defined at onCreate (held as private, not static)

        @Override
        protected String doInBackground(Void... params) {
            temp = buildLog();
            logdata = temp;
            publishProgress();
            createLogFile();
            return temp;
        }

        protected void onProgressUpdate() {
            progressdialog.setMessage("Compiling Log File...");
        }

        @Override
        protected void onPreExecute() {
            Log.w(TAG,"Showing Dialog");
            send.setEnabled(false);
            ProgressDialog progressdialog = new ProgressDialog(context);
            progressdialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            progressdialog.setMessage("Gathering Data...");
            progressdialog.setCancelable(false);
            progressdialog.setOnDismissListener(new DialogInterface.OnDismissListener() {

                @Override
                public void onDismiss(DialogInterface dialog) {
                    Log.e(TAG,"Progress Dialog dismissal.");

                }
            });
            progressdialog.show();
        }

        @Override
        protected void onCancelled(){
            Log.e(TAG,"Progress Dialog was Cancelled");
            progressdialog.dismiss();
            logdata=null;
        }

        @Override
        protected void onPostExecute(String result) {
            progressdialog.dismiss();
            send.setEnabled(true);
            previewAndSend();
        }

    }
  • 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-24T17:23:54+00:00Added an answer on May 24, 2026 at 5:23 pm

    You have two different progress dialogs there, one local to onPreExecute() and one global. The one ur dismissing in your onPostExecution() is your global one which was never actually shown. Remove the local declaration and it should work.

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

Sidebar

Related Questions

I'm using AsyncTask s to fetch data in response to the user pressing a
I'm using this tutorial on AsyncTask with a task and a notification: https://eliasbland.wordpress.com/2011/03/11/an-example-of-how-to-run-a-background-task-and-report-progress-in-the-status-bar-using-asynctask-on-android/ What
In my app I have a background task (using AsyncTask) that downloads stuff from
i'm using AsyncTask to retrive data from RSS ,,i'm showing a progress Dialog in
Currently, I'm using AsyncTask to handle Http connection and retrieve data as JSON format.
I am trying to download multiple file using AsyncTask. I start each download in
Im using HTC Hero with HTS sense. Im experience that sometimes AsyncTask not will
Using PyObjC , you can use Python to write Cocoa applications for OS X.
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using C#, I need a class called User that has a username, password, active

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.