When to use a Content Provider

后端 未结 9 1476
没有蜡笔的小新
没有蜡笔的小新 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条回答
  •  -上瘾入骨i
    2020-11-27 11:13

    If you are not planning to share data, don't think about Content Providers. They are powerful but hard to write and it will be just silly to implement them if you are going to use them internally.

    However, I'm wondering if anyone has thoughts about making a Content Provider to use just within your own app.

    Of course... for instance, for an old TODO list app I wrote, I had to write a content provider to allow other apps retrieve and access the tasks states. It was part of the requirements, but more than that it made sense and made the app nicer.

提交回复
热议问题