When to use a Content Provider

后端 未结 9 1477
没有蜡笔的小新
没有蜡笔的小新 2020-11-27 10:52

I understand that Content Providers are made to allow publicly sharing data between applications. However, I\'m wondering if anyone has thoughts about making a Content Provi

9条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-27 11:36

    I agree ContentProviders are a little difficult to grasp but they are definitely helpful, even if you want to use them internally for you own app. The best thing about it is that you can customize the contentproviders for suitable URIs.

    Here's a scenario where you may have 5 tables in your database, but you need to join a few of them in certain orders before using them. And make a content URI for each of these joins. You could then each use these URIs as a table :)

    I suggest you go ahead with Content Provider, you'll be amazed to see how powerful it is.

提交回复
热议问题