What is the difference between ContentResolver and LoaderManager?

1.1k Views Asked by At

I don't understand difference between ContentResolver and LoaderManager.

2

There are 2 best solutions below

0
On

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

0
On

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.