suresh cheemalamudi
suresh cheemalamudi

Reputation: 6240

Android - dismiss progress bar automatically

when the app is launched, I inflate a progress bar from main.xml file which is shown until the list is empty. Once the list is populated with data which is coming from URL, i should dismiss this progress bar. How can i do this without using progress dialog?

my main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <ListView
        android:id="@+id/list_view_places"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        android:drawSelectorOnTop="false"
        android:fastScrollEnabled="true" >
    </ListView>

    <ProgressBar
        android:id="@+id/empty_progress_bar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true" />

</RelativeLayout>

Upvotes: 1

Views: 9348

Answers (3)

Hanisha
Hanisha

Reputation: 887

Try this :
globalProgressDialog.dismissProgressDialog();

Upvotes: 0

androiddeveloper2011
androiddeveloper2011

Reputation: 226

If you will use list fragment then progress bar is automatically handled. once data is populated it will automatically dismiss.

Upvotes: 3

Raghav Sood
Raghav Sood

Reputation: 82543

Try something like:

ProgressBar bar = (ProgressBar) findViewById(R.id.empty_progress_bar);
bar.setVisibility(View.GONE);

Upvotes: 10

Related Questions