Reputation: 41
I don't understand difference between ContentResolver
and LoaderManager
.
Upvotes: 3
Views: 1118
Reputation: 1356
ContentResolver
is the layer between your application and other applications's ContentProviders
(and maybe your own ContentProviders
). You use them by calling ContentResolver.query()
. However, since queries could take a while, you need to make the call on a separate thread, which you can either do by yourself, with an AsyncTask
or something else, or you can use a CursorLoader
, which is managed by the LoaderManager
class.
From http://developer.android.com/guide/topics/providers/content-provider-basics.html:
For the sake of clarity, the code snippets in this section call ContentResolver.query() on the "UI thread"". In actual code, however, you should do queries asynchronously on a separate thread. One way to do this is to use the CursorLoader class, which is described in more detail in the Loaders guide.
That's the connection between the two.
Upvotes: 2
Reputation: 5600
Thery are different, i dont know why you compare, maybe we need to know the context.
ContentResolver resolves a URI to a specific Content provider.
LoaderManager helps an application manage longer-running operations in conjunction with the Activity or Fragment lifecycle
Upvotes: 2