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

The Archive Base Latest Questions

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

to show a background process i used ProgressDialogBox . My code is as add_button.setOnClickListener(new

  • 0

to show a background process i used ProgressDialogBox.

My code is as

add_button.setOnClickListener(new OnClickListener() {


        public void onClick(View viewParam) {


            progressDialog = ProgressDialog.show(AddTicketActivity.this, "", "Loading...");

            new Thread() {

            public void run() {

            try{

            sleep(10000);

            } catch (Exception e) {

            Log.e("tag", e.getMessage());

            }

            progressDialog.dismiss();
            }

            }.start();

Its working fine. But the problem is progess shows for 10000 ms where as i want it to show untill my data is fetched/added. i mean it should be dependent on fetching/adding time.

i thought to do like it

public void onClick(View viewParam) {

progressDialog = ProgressDialog.show(AddTicketActivity.this, "", "Loading...");

Fetching data code here

progressDialog.dismiss();
}

But it dint work, does not show any progress bar.

How can i use it.

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-26T14:02:12+00:00Added an answer on May 26, 2026 at 2:02 pm

    Well your code is fine :

    public void onClick(View viewParam) {
    
        progressDialog = ProgressDialog.show(AddTicketActivity.this, "", "Loading...");
    
        // Fetching data code here
        // ...
        // Data Fetched
    
        progressDialog.dismiss();
    }
    

    This should work, as long as your are fetching the code in the same thread (although that might lead to an ANR. Consider using AsyncTask).

    EDIT : Note that if you are fetching data in a separate thread, according to your logic you will show your progress dialog and then immediately close it.

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

Sidebar

Related Questions

Background My task is to, in SharePoint, show an image of a process map
Background: I'm running a Monte Carlo simulation to show that a particular process (a
What I am trying to do is to show both background-color and background-image ,
I have a DataGrid that needs to show a gradient background on mouseover of
I'd like to show a div that has a background-color with the height and
I have a background worker running a long database task. i want to show
So the transparent background problem is solved. Now, every time I show the form
I have a div with 60% opacity, to show part of a background image
I'm in the process of setting up a background task that makes network calls;
I am from an XP background. I know the process very well and have

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.