I have an activity with a listview populated from the web.
While data is loading I would like to display a progress dialog instead of the listview.
My layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ProgressBar
android:id="@+android:id/progress_large"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
<ExpandableListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
I do this so that the progress bar shows itself (and this works):
setProgressBarVisibility(true);
However, once the listview is populated (with an AsyncTask), I’d like the progress bar to disappear which is not the case, it stays above the listview.
Here is what I did in the AsyncTask:
@Override
protected void onPostExecute(Void result) {
setProgressBarVisibility(false);
//... and some code to update UI
}
Do this in your code,