Search code examples
firebasegoogle-cloud-firestorefirebaseui

Add progress indicator to FireStoreRecyclerAdapter and maintain recyclerviev visibility after app resume


I am using firebase to build my apps, however, when I open the app, it takes some time to show in recyclerview. Also,when I resume the activity after some time the recyclerview does not show.

  1. How can I add progress indicator to appear to the user when still loading data?
  2. How can I solve the problem of recyclerview disappearing?

Solution

  • How can I add progress indicator to appear to the user when still loading data?

    How can I solve the problem of recyclerview disappearing?

    Regarding the first one, all you need is to add a progress dialog or progress bar. https://developer.android.com/reference/android/widget/ProgressBar.html

    Regarding the second question:

    When you go to another activity and then press the back button, onResume() is getting triggered that is why there is no data. So it is better to retrieve the data in onResume() instead of onCreate()

    lifecycle