I have a Main activity with a few methods.
- GetTopics: calls REST API and returns JSON results
- BindTopics: displays the results from GetTopics on the screen
There are a few others with similar functionality, but I’m sure I can fit the solution to these across all methods.
Question: What is the proper way to run these in separate threads? Should both of them be in the same thread? Should I call BindTopics once GetTopics is complete?
Either way, doesn’t the UI get built prior to the async threads are completed? If so, how do I update the UI?
Any help is appreciated.
I would load it in a progress dialog with an AsyncTask. You will need to declare the handler to update controls in the UI thread.
Example: