I am using AsyncTask to upload data to UI. i wrote the code to download data from server in a separate method and i am calling that method from doinBackground. It will give
Use doInBackground() just for tasks that :
doInBackground()
Then you can implement AsyncTask.onPostExecute() to run code to handle those results on main UI thread from AsyncTask
AsyncTask.onPostExecute()
From JavaDoc for AsyncTask.onPostExecute():
"Runs on the UI thread after doInBackground. ... "