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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:17:12+00:00 2026-05-26T04:17:12+00:00

In my app, at the click of a button, the app does some processing,

  • 0

In my app, at the click of a button, the app does some processing, sends some data over the network and then stops. As it takes some time, I tried putting in a progress bar. The code for the progress bar is at the beginning of the onclick listener for the button. After the progress bar code, the processing and sending data over the network takes place.
But the progress bar is not visible at all. Do I need to necessarily show the progress bar in a separate thread?

This is what i have used to show the progress bar

final ProgressDialog pd=new ProgressDialog(this);
pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
pd.setMessage("Please wait..");
pd.setCancelable(true);
pd.setIndeterminate(true);
pd.show();
  • 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-26T04:17:12+00:00Added an answer on May 26, 2026 at 4:17 am

    use the AsyncTask class which was used to do process in background and you can also showing up your progressbar there

    Here is the simple snippet of code for AsyncTask

    class BackgroundProcess extends AsyncTask<Void,Void,Void>{
       private ProgressDialog progress;
       public doInBackground(Void...arg){
            publishProgress();
            // do your processing here like sending data or downloading etc.
       }
       @Override
       protected void onProgressUpdate(Void... values) {
        super.onProgressUpdate(values);
        progress = ProgressDialog.show(YourActivity.this, "", "Wait...");       
       }
       @Override
       protected void onPostExecute(Void result) {
        super.onPostExecute(result);
        if(progress!=null)
            progress.dismiss();
        progress = null;
       }
    }
    

    now initialize and execute it in button onclick listener like this way

    new BackgroundProcess().execute();
    

    now progressdialog will be publish and appear on the screen and when process was completed then from the onPostExecute() just dismiss the progress dialog

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

Sidebar

Related Questions

In my PyGTK app, on button click I need to: Fetch some html (can
I'm in the midst of writing a slide show app (click a button, and
In my Swing app, users can click a button to open a dialog panel
Hello StackOverflow'ers, I have a (flex) app that, on the click of a button,
I need a function that a user can just click a flash app button
We have a launcher app that does some setup (starting a server), launches a
In my typical app, the user clicks a button in an aspx page, invokes
When we click on a specific contact in the contacts app in the iphone
I'm making another app's window topmost to ensure that a click in my app
I want to make a right click menu for my winforms app. It will

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.