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

The Archive Base Latest Questions

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

I am trying to specify a progress spinner as I have done in my

  • 0

I am trying to specify a progress spinner as I have done in my testLayout.xml file, and then programmatically display and hide it as I have done in my activity code below. Whats happening however is that the progress wheel will display, but it never goes away even though I have setProgressBarVisibility(false); at the end. Any ideas? Thanks for input

layout/testLayout.xml

    <Button android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:id="@+id/ButtonNew"
        android:text="New" android:layout_alignParentBottom="true" />

    <ListView android:layout_width="fill_parent"
        android:layout_height="fill_parent" android:id="@+id/list"
        android:layout_alignParentTop="true" android:layout_above="@id/ButtonNew" />

    <ProgressBar style="?android:attr/progressBarStyleLarge" android:layout_width="wrap_content" android:id="@+id/progressBar1" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true"></ProgressBar>


</RelativeLayout>

TestActivity.java

    public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                getWindow().requestFeature(Window.FEATURE_PROGRESS);
                setContentView(R.layout.testLayout);            
                setProgressBarVisibility(true);
    try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
setProgressBarVisibility(false);
    }
  • 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:51:09+00:00Added an answer on May 26, 2026 at 2:51 pm

    Well there is a problem in your code because your Thread.sleep call will cause the onCreate to wait 5 seconds before continuing. You should never perform a Thread.sleep call on the main UI thread as it will cause the application to not respond for that amount of time. Now with regards to the ProgressBar, it seems that you are not correctly using the setProgressBarVisibility with your xml file. Those functions should be used for ProgressBar’s that are contained in the title bar. You should just use findViewById(R.id.progressBar1).setVisibility(View.Gone) to hide or View.Visible to show. But if both of these calls are done inside of the onCreate you will only see the one that was called last. This is because no ui is actually shown to the user until the activity has returned from onResume and onCreate.

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

Sidebar

Related Questions

I'm trying to specify a relative directory in the web.xml file. I basically want
I am trying to write some XML schema code to specify that a particular
I'm trying to specify the licence for my wix setup project. I have created
I'm trying to specify a version of the thrift gem in my gem file.
I'm trying to specify programmatically settings for scanning in TWAIN session. Because amount of
I am trying to specify some additional targets/tasks to an msbuild file by extending
EDITED I'm trying to have source files recompiled without having to specify header files
I am trying to specify an alternative jre (my default is 1.6 and i
I've been trying to specify a dimension in pixels as a resource, so I
Using CSS, I'm trying to specify the height of a span tag in Firefox,

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.