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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:59:04+00:00 2026-06-14T17:59:04+00:00

I want to show the progress dialog while loading the images in grid view.

  • 0

I want to show the progress dialog while loading the images in grid view.
The problem i’m facing was the current thread and Progress Dialog thread running simultaniously.

 public String Method1(){
        String output="";
        final ProgressDialog aProgDialogL = ProgressDialog.show(this, "", "Loading...");
        Thread thread = new Thread() {
            public void run () {
                //My codes
                aHandlerL.post(new Runnable() {
                    @Override
                    public void run() {
                        //Post Runnable codes
                        aProgDialogL.dismiss();
                    }
                });
            }
        };
        thread.start();

        /*
         * 
         * 
         * OTHER CODES
         * 
         * 
         */
        return output;
 }  

In the above example I need to run the code inside Progress Dialog Thread. After it finish executing i need to run my “OTHER CODES”. How to do it?
.
I tried using Async task. Before async task completes method1 gets extcuted and reurning the string.

    public String Method1(){
    String result="";
    new GetImages().execute();
    return result;

}
public class GetData extends AsyncTask<Void, Void, Integer>{

    @Override
    protected void onPreExecute() {
        aProgDialogL = ProgressDialog.show(Main.this, "", "Loading...");
    }

    @Override
    protected Integer doInBackground(Void... params) {
        //Progress Dialig Code
        return null;
    }

    @Override
    protected void onPostExecute(Integer result) {
        aProgDialogL.dismiss();
        //OTHER CODES
        super.onPostExecute(result);
    }

}
  • 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-14T17:59:05+00:00Added an answer on June 14, 2026 at 5:59 pm

    You can use Async task. http://developer.android.com/reference/android/os/AsyncTask.html. There is a good tutorial here. http://www.vogella.com/articles/AndroidPerformance/article.html.Also have a look at this link
    http://developer.android.com/guide/components/processes-and-threads.html. Use asynctask modify it according to your needs.

         doInBackground()- For long running operations. Don't update ui here.
         onPreExecute()- update ui before running the operatio nin background.
         onPostExecute()- update ui after running the operation.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While I'm updating my database I want to display a progress dialog. My problem
I want to show a Progress Dialog on button click in my app while
I want a progress dialog saying Please Wait , while my code downloads and
While uploading multiple image at a time i want to show progress bar which
I want to create such a dialog to show progress bar like I have
Actually i have a problen while using progress dialog.The problem is not with the
I am trying to use a progress dialog while my webview is loading and
I want to show progress with jquery ui progress bar when an ajax request
I want show annotation view (above one of my pin) after load map. For
hii I want show a pop up Dialog box when i click on to

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.