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

  • Home
  • SEARCH
  • 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 7781395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:12:53+00:00 2026-06-01T19:12:53+00:00

Ok so. I want to set a progress bars visibility to VISIBLE when I

  • 0

Ok so. I want to set a progress bars visibility to VISIBLE when I am pressing a button for example… and then I want to set the visibility to GONE when I am resuming the same activity.

at the same time as loading other data if possible.

Here is what I am trying:

public void onPause(){
super.onPause();
final ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar);
progressBar.setVisibility(View.GONE);
}

and

    Button aButton = (Button) findViewById(R.id.abutton);
    aButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
        final ProgressBar   progressBar = (ProgressBar) findViewById(R.id.progressBar);
        progressBar.setVisibility(View.VISIBLE);


    Intent i = new Intent("org.packagename.etc.etc");
        startActivity(i);
        }
    }); 

but it doesn’t work because when I click the button it doesn’t show the bar it just jumps straight to the activity (which loads data so takes a few seconds). So it needs to be threaded or something?

halp meh!

  • 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-01T19:12:56+00:00Added an answer on June 1, 2026 at 7:12 pm

    The problem here(If i am right) is that the progress bar is a part of the activity you are currently running, and you want to show it while another activity (“org.packagename.etc.etc”) is doing some work?

    If that is the case, you should start the progress bar in the activity that does the work. But that by itself will not work either. You have to do the work in a seperate thread! You should look into using an AsyncTask for the data loading.

    This tutorial might help you with that. http://www.vogella.de/articles/AndroidPerformance/article.html

    When you start a progress bar, it runs on the UI thread, but if you also do your work on the UI thread, it will not display the progress bar until the other work is finished. And by then, you will most likely already have hidden the progress bar again.

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

Sidebar

Related Questions

I want set progress bar until the next activity start.That mean i want to
i want set the visibility to itemized overlay in map view. if the zoom
I want to set a progress bar for my application. I am using a
I am using an activity with the dialog theme set, and I want it
In a function handling a registration form I want to set the visibility of
Summary: I want to track the progress of file downloads with progress bars inside
I want to set timeout for Dialog (progress dialog) in android , to make
I want set interfaceOrientation in one UIView as LandscapeLeft and Portrait in other UIView.
I want set Listbox background to transparent but not working Is there any idea?
i want set class for repeater when doPostBack for those dataID i wan but

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.