Android progress spinner, able to display but not to hide programmatically
<p>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</p>

<p>layout/testLayout.xml</p>

<p>
    </p>

<pre><code>    &lt;Button android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:id="@+id/ButtonNew"
        android:text="New" android:layout_alignParentBottom="true" /&gt;

    &lt;ListView android:layout_width="fill_parent"
        android:layout_height="fill_parent" android:id="@+id/list"
        android:layout_alignParentTop="true" android:layout_above="@id/ButtonNew" /&gt;

    &lt;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"&gt;&lt;/ProgressBar&gt;


&lt;/RelativeLayout&gt;
</code></pre>

<p>TestActivity.java</p>

<pre><code>    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);
    }
</code></pre>
