Issue
I have 2 async tasks:
- I'm getting user's location;
- I'm getting list of events from my API using Retrofit;
My question: How do I set an action only after I get successful result from both methods? Thank you.
Solution
1) Make 2 asynctasks.
2) in the first asynctask get users location in doInBackground() and then in onPostExecute() start the second asynctask.
3) in the second asynctask get events from api in doInBackground().
4) then in the onPostExecute() of second asynctask you do what ever you want do (because both tasks are finished).
here they say asyncTask is deprecated so be careful.
Answered By - Hasan Bou Taam
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.