Reputation: 2480
I'm loading a DB on app's startup and right after that I check whether there are any updates on the server. I use Volley for that. The problem is, the program starts the data updating before it even got the value from Response. So what I need is to wait for the response to finish and only then update my data with the jsonArray I got from there. But Volley is asynchronous so I can't figure out a way to do that and I'm not even sure that's something possible. Can something like this be implemented ?
Upvotes: 2
Views: 836
Reputation: 10205
Create an activity that act like a SplashScreen. The activity only shows to the user a loading screen and in the background is waiting for the volley request. When the request ends, the activity parse the data and do whatever you want. After that launch the second activity to show the data to the user.
Other alternative is just display a fullscreen progress dialog and dismiss the dialog when the request finish.
Upvotes: 1