Progress bar visible before firebase loading and gone after loading is done

0
Himanshu Malik | 12 xp

I want to add a library of a progress bar in my app in which the progress bar visible before the firebase image data loading and after loading the progress bar Gone. I am using Retrofit and Firebase Storage for saving my wallpaper application images. All the images are loading in Recycler view with Grid Layout. I want to show a progress bar before the loading and after when the loading is done the progress bar should Be Gone.

0
Sindhuja K | 206 xp

hi…

The simple and best way to show a progress bar while loading data from server is, to include a progress bar in your xml file and set indeterminate to ‘true’.

<ProgressBar

android:id=”@+id/progressBar”
style=”?android:attr/progressBarStyle”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:indeterminate=”true”
android:indeterminateTint=”@color/colorAccent”/>

 

If you are using Async task, then inside onPreExecute(), you can set the progress bar variable.setVisibility to VISIBLE. After loading and setting the data in onPostExecute, you can set progressBar.setVisibility(VISIBLE.GONE).