Issue
I am a bit stumped on a problem and forgive me as I am very new to android development. I did some searching and found quite a few differing opinions. I have an AsynchTask that calls a webservice and returns a bunch of json results. I have to (& want to) run my webservice asynchronously. the result set will need to be rendered inline within a RelativeLayout. I attempted to do this in my asynchronous thread but Android doesn't allow updating the UI from anything that isn't the main thread.
I see the Runonuithread but I can't call my asynchtask from my ui thread.
What is the best way to call my webservice asynchronously, get the results, and then update the mainUI on the original thread. Is there a best practices from an architecture perspective.
Solution
onPostExecute() is run on the ui thread, so try using that method to do your work. Otherwise, you can use the Handler class to communicate between threads.
Answered By - Joel
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.