Can anyone please tell me difference between AsyncTaskLoader vs AsyncQueryHandler?
I want to use AsynTaskLoader in my app.. The existing one in my app is AsyncQueryHandler..
Am I right about that AsyncTaskLoader is the replacement of AsyncQueryHandler?
Correct me If I am wrong.. I am very new to android.
If you read the docs :
AsyncQueryHandler
:
A helper class to help make handling asynchronous ContentResolver queries easier.
AsyncTaskLoader
:
Abstract Loader that provides an AsyncTask to do the work. See Loader and LoaderManager for more details.
So they are pretty different. AsyncQueryHandler
is used for querying/inserting asynchronously into a ContentResolver
, and the AsyncTaskLoader
it is an implementation of the new Loader
mechanism (introduced in API Level 11) which uses an AsyncTask
do to any kind of background processing (HTTP, SQL, etc).
You should also look at CursorLoader
, maybe it is what you need.
I would say that if you just want to read from a ContentResolver
you should use a CursorLoader
, but if you want to insert, delete etc. into that ContentResolver
, maybe it is better to use the AsyncQueryHandler
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With