Reputation: 6240
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
Reputation: 226
If you will use list fragment then progress bar is automatically handled. once data is populated it will automatically dismiss.
Upvotes: 3
Reputation: 82543
Try something like:
ProgressBar bar = (ProgressBar) findViewById(R.id.empty_progress_bar);
bar.setVisibility(View.GONE);
Upvotes: 10