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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:17:27+00:00 2026-05-17T21:17:27+00:00

Elegant Solution Hey People. I’m currently working on a Project and I am thinking

  • 0

Elegant Solution

Hey People.
I’m currently working on a Project and I am thinking of an elegant solution for the implementation, I’m tired of improvised solutions.

Let me try to explain my “Problem” to you:

The task of this part of my app is pretty simple:

I want my app to download some stuff and process that downloaded file in the background, displaying a ProgressDialog in the meantime. After that, the contents should be returned in a List of Strings which are displayed in some ListActivity. So far, not a big deal:

Downloader and the processing stuff is a subclassed AsyncTask and called in a class different from the main Activity. But now my Problem:

Where to call the Progressdialog? And how can the GUI-Thread “react” with a ProgressDialog? Should I call the ProgressDialog from the processing class or is it better to kind of “block” the main class, waiting for a notification?

Greetings

EnflamedSoul

  • 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-17T21:17:28+00:00Added an answer on May 17, 2026 at 9:17 pm

    Define your progess dialog as a global variable.

    ProgressDialog pd;
    

    Where you are going to fire off the asyncTask:

    showYourProgressDialog;
    thread = new aThread().execute();
    

    In your class:

    public class aThread extends AsyncTask<Void, Void, Void> {
            @Override
            protected Void doInBackground(Void... args) {
                try {
                    //Do your downloading and stuff
                                    asyncHandler.sendMessage(asyncHandler.obtainMessage(0));
                } catch (Exception e) {
                    Log.e("1", "Error", e);
                }
                return null;
            }
        }
    
    Handler asyncHandler = new Handler() {
            public void handleMessage(Message msg) {
                pd.dismiss();
                if (msg.what == 0) {
                    //update what you need to               
                }           
            }
        };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there an elegant solution for synchronizing sessions across multiple ASP.NET applications? I'm sure
I'm looking for an elegant, high performance solution to the following problem. There are
Hey all, quick NHibernate question. In my current project, we have a denormalized table
Is there a more elegant solution to convert an ' Arraylist ' into a
Is there a more elegant solution for this question? I have about 70 .png
Just wondering if any know of an elegant solution for the following. If I
I've looked everywhere for an elegant solution. The essential problem seems to be that
What is an elegant way to sort objects in PHP? I would love to
Is there an elegant way to have performant, natural sorting in a MySQL database?
What is the most elegant way to solve this: open a file for reading,

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.