Reputation: 332
I am developing the typical RSS application. In the method onCreate define the layout to paint the screen and in the method onResume do a query to a URL to extract the data. Should paint the screen and then check the URL, right? because I do not paint the screen until the request to the URL has been answered.
How do I get paint the screen and before refer to the URL? Thanks a lot.
Upvotes: 0
Views: 840
Reputation: 10908
If you are going to query a URL to retrieve some data, then this should be done in either an AsyncTask
or a new Thread
/Handler
combination. If you load the URL in onResume
then the data load is happening in the UI thread, which can block user interaction and cause your app to be killed by the OS.
Upvotes: 2