Before listViewTweets.setAdapter(adapter);
insert:
listviewo.setEmptyView(findViewById(R.id.loading));
loading is a ProgressBar
put it inside your XML where you have the ListView
:
<ProgressBar
android:id="@+id/loading"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:indeterminateDrawable="@anim/loading_rotation"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:visibility="gone" />
by this: android:indeterminateDrawable="@anim/loading_rotation"
i created a picture that rotate.
to set the animation just create an xml
file put it in a folder called anim
:
<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/iconloading"
android:pivotX="50%"
android:pivotY="50%" />
the loading picture isiconloading
.
hope this helps.