Loader is not a replacement for AsyncTask. In fact, Loader itself does nothing, it is just the hook into interacting with the lifecycle of LoaderManager/Activity/Fragment.
AsyncTaskLoader is a Loader that uses an AsyncTask to do its loading on a separate thread. This also is not a replacement for AsyncTask; it is a convenience for doing background operations via AsyncTask that is managed on conjunction with the lifecycle of the LoaderManager/Activity/Fragment. If AsyncTaskLoader makes it easy to do what you want, then great use that. If not, then use whatever works best for you -- AsyncTask, a Thread, etc. On Mon, Nov 28, 2011 at 8:00 AM, Chris Stewart <[email protected]>wrote: > It seems like the Loader is now a replacement for AsyncTask, but does it > also replace the use of a Runnable/Thread scenario? The AsyncTask is more > difficult to set up, so I understand why a Loader makes sense there ( > http://stackoverflow.com/questions/5603504/android-3-0-what-are-the-advantages-of-using-loadermanager-instances-exactly). > In my scenarios, I have data being loaded from a web service but there's a > progress dialog and action only needs to be taken after the process is > completed. So for this I've always created a runnable, started a new > thread from that, and have an "on UI" runnable that's called after the > processing is completed. Should I instead be looking at using Loaders for > this moving forward? > > -- > Chris Stewart > > > On Wed, Nov 9, 2011 at 7:03 AM, Mark Murphy <[email protected]>wrote: > >> On Tue, Nov 8, 2011 at 10:51 PM, Chris Stewart <[email protected]> >> wrote: >> > Thanks for the reply Dianne. I'm not completely sure what you mean by >> > custom loader, are you referring to what was introduced in 3.2? If so, >> is >> > it available in the support library for pre-3.2? >> >> The Loader framework is in the Android support package / compatibility >> library / thingy. :-) >> >> -- >> Mark Murphy (a Commons Guy) >> http://commonsware.com | http://github.com/commonsguy >> http://commonsware.com/blog | http://twitter.com/commonsguy >> >> Warescription: Three Android Books, Plus Updates, One Low Price! >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en >> > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

