Issue
I need some suggestion on how to go about this specific android problem: activity A passes an intent to activity B, B reads it, makes an API call, B receives response, parses it, and updates its views from the response
now it works fine except fr a 2 second black screen during transition from A to B is asynctask a solution? becoz the parsing data is not much and also is there a way to update UI views frm asynctask
Solution
To echo what Lalit said, an AsyncTask will help in this case. The problem that you're having is that doing the API call during onCreate
is blocking the activity from updating the UI. If you use an AsyncTask, it will allow the activity to continue rendering the view.
As you're parsing the result, you can update the UI by calling Activity.runOnUiThread()
or by putting the UI code in onPostExecute
.
Answered By - spatulamania
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.