0

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?
Geek Guy
  • 710
  • 1
  • 8
  • 28

1 Answers1

1

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

Community
  • 1
  • 1
Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
  • Great @Peter how can I attach a progressbar to FireStoreRecyclerAdapter's loading process? especially when I have several adapters in one activity and I want to monitor one on a button-click event when the user clicks a button immediately after starting activity and adapter has not loaded. I have tried various ways but failed – Geek Guy Jan 26 '18 at 21:02
  • @GeekGuy just add a progress bar in the code before the code where you retrieve data and give it some seconds also – Peter Haddad Jan 26 '18 at 21:23