This is basically a conceptual question, I tried reading docs but still I couldn't get a better understanding of the topic. I am not sure how I should use async task.... I have used the async task before for displaying an image from internet, but I am still confused how it works. I know 3 of its functions that are used commonly. i.e
onPreExecute ()
doinBackground()
onPostExecute()
Now I am confused that if I have to populate a list. How should it be done?
I know the populating part should be done in the doinbackground()
, but after that should I return the result (from the background), after the whole list has been populated, to onPostExecute()
and expect that the list will be loaded on the listview asynchronously or should I return the result in parts(say a new item has been added to the list, send it to the onpostexecute immediately without waiting for the whole list to be generated, to be displayed and repeat the iteration ) to the onPostExecute()
? And manage the lazy load ourselves by doing so?