I have been developing an Android application where every time the user opens the app, it loads some data from the Firebase Realtime database using addListenerForSingleValueEvent
and the app never reads anything else from firebase during the rest of the session.
Everything works well but since this is an asynchronous process, I want to prevent users from entering the main activity before everything is loaded from firebase completely because that may cause views to be loaded before the data they use has arrived.
I thought of a solution: Implementing a thread that will check if all the data is loaded and will only let the main activity start when the process is over.
So my questions are:
1- Would the solution I thought of be a good one?
2- Should I instead use some other approach like using Firebase Rest API or anything else?