0

I would like to know, what is the best way to store data from a firebase data in the background of my android app so that it can be used on the UI at any time.

Currently I am accessing the database and then applying the data to the UI within public void onActivityCreated in my fragment but it takes a few seconds to load the data meaning that every time the user accesses this fragment, they are sat waiting for the data to load.

I feel like it would be better for the user if the data was stored somewhere in the background so it could be used instantly at any time in order to reduce loading times but I'm not really sure how to go about it.

Any help appreciated, thanks.

Paul Alexander
  • 2,686
  • 4
  • 33
  • 69

1 Answers1

0

I discovered what I was looking for was the singleton pattern.

Singleton in Android

https://code.tutsplus.com/tutorials/android-design-patterns-the-singleton-pattern--cms-29153

Paul Alexander
  • 2,686
  • 4
  • 33
  • 69