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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:50:42+00:00 2026-05-20T00:50:42+00:00

i want to show a PD when my activity A starts another activity B.

  • 0

i want to show a PD when my activity A starts another activity B. But in that onclick method, my A activity haves to do some work before start B, and B also haves to do some work because it haves to load a lot of data for the UI.

I need a PD that is viewed by the user in all the process of the loading data of changin from activity A to B.

¿how can do it?

i tryed storing a static ProgressDialog on MyApplication.java, and with these methods:

public static void showProgressDialog(Context c) {
    pd = ProgressDialog.show(c, c.getResources().getString(R.string.app_name), 
        c.getResources().getString(R.string.loading), true, false);    
}
public static void dismissProgressDialog(){
    pd.dismiss();
}

but it doesn’t works, it doesn’t shows nothing, i dont know why

how to achieve this by a easy way? i know that i can do it with async task, but that is too hard for me, i can’t understand the code examples i am finding on this web and google

code examples are welcome

thanks

  • 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-20T00:50:43+00:00Added an answer on May 20, 2026 at 12:50 am

    well, i agree with @Falmarri comment, the easy way is implementing that with an AsyncTask. Because AsyncTask manages the UIThread and a background thread.

    i always do this with AsyncTask but i don´t think that paste here my code will help you, because your requirements maybe are not like mine, but i think you can do in this way;

    Subclass the AsyncTask and override these methods;

    • onPreExecute()… because this
      method is invoked in the ui thread
      you can create and show the progress
      dialog.
    • doInBackground(Runnable task)…
      this method run in a background
      thread so you don´t have to worry
      about Threads handling… all you
      have to do is the hard work
      (process data, download data, etc)
      and publish any update to the ui that
      you want.

    • onProgressUpdate(Object… values)…
      this method also is called in the ui
      thread, so you can update your
      progress dialog with the progress
      values.

    • onPostExecute(Object result)…
      this method run in the ui thread
      so, you can show the operation
      result and dismiss the progress
      dialog, and invoke your new activity.

    you can do all operations here, the activity A operation and activity B operation, and the AsynTask will manage for you the Threading management 🙂

    Edit 1:

    i don’t know how much complex is your desing but here i make a project example, maybe it’s not what you want but it has all stuff decribed here, in my answer, maybe like an example works.

    i suggest that you read more about this class because is one of the most important, here you can read more about this mechanism…
    http://android-developers.blogspot.com/2009/05/painless-threading.html

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

Sidebar

Related Questions

Suppose There are some activity. I want to start another activity from the main
What I want is that when Activity starts first time, it first checks if
I want to show the status of some files in a Java GUI. Each
want to make an Android app that starts with a main layout and when
I have an activity that starts 3 threads that make a While(true) loop when
I'm very new on Android development. I want to create and start an activity
I don't know how to start an Intent to call another activity from my
Hi I am using SQllite in my application. In that I want to show
I have an activity that starts after a certain time. Once this activity starts,
I want show annotation view (above one of my pin) after load map. For

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.