Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can loaders be used without content provider or combination is must?

  1. Can loaders be used without content provider or combination is must?

  2. Is it best practice to use content provider only when it is intended to use by other applications or for only local use also content provider is recommended?

  3. If data updated in SQLite, Will loader deliver updated data, if not used with content provider?

I have tried to find convincing answers to above questions, but could not find it. Please help.

like image 604
Darshan Kapasi Avatar asked Oct 30 '22 15:10

Darshan Kapasi


1 Answers

  1. A Loader is a way to load information for your activity/fragment without performing the computation on the UI thread. It can be used with a Content provider or you can use a subclass of Loader/AsyncTaskLoader to access data of your own choosing. You can find more info on how and when to use a Loader here.
  2. It is best practice to use a content provider to access data when a content provider is available. They are maintained by the system and are a good way to ensure the consistency of the data provided. You can create your own content provider to provide data from one application to another. More information can be found here.
  3. You can create a loader for an sqlite database by follwing the info in this guide at section 7 here.
like image 54
J Whitfield Avatar answered Nov 13 '22 01:11

J Whitfield