I have an activity which contains a recyclerView
that loads data from the database. Sometimes when starting the activity I don't see the data until reloading the activity.
What I'm trying to do is show a loading animation for 3 seconds and wait for it to load then show it.
I added this to my xml:
<RelativeLayout
android:id="@+id/loadingPanel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center" >
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true" />
</RelativeLayout>
But how can I make my activity wait for 3 seconds (showing the loading animation) and then go back to the activity with loaded data?