1

I read the Android Developer Documentation about Loader and AsyncTask and also read this question here which one is better, loader or AsyncTask?

but I still don't get the main difference between both? Why is it better to use Loader instead of a AsyncTask ?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Blnpwr
  • 1,793
  • 4
  • 22
  • 43
  • 1
    You can find some relevant information from this link: https://nayaneshguptetechstuff.wordpress.com/2014/06/21/asynctask-vs-loaders-why-loaders-are-introduced/ – Ghulam Moinul Quadir Oct 20 '17 at 12:49

1 Answers1

2

There is not much difference in the Loaders and AsyncTask but AsyncTask gets messy when you want to pause activity, want to destroy the activity you need to call asyncTask.cancel() but it also takes which sometimes crashes the app. On the other hand Loaders were introduced in Honeycomb and now available with support library.Loaders mainly handle the configuration changes,Loaders (specifically the CursorLoader) really shine when using Cursors within Android to pull data.