Android ContentProvider database query multiple tables

后端 未结 1 1398
忘掉有多难
忘掉有多难 2020-12-13 16:06

I\'m writing an RSS reader for Android. I\'ve faced a certain difficulty which the problem I can\'t resolve since databases aren\'t my expertise.. So i figured out maybe one

相关标签:
1条回答
  • 2020-12-13 16:45

    While CommonsWare's answer is right to some degree I find it doesn't fully answer the question.

    Normally ContentProviders are a way to share/expose the application's data and in fact this may often be the case. Still, there may arise the situation where one needs to join multiple tables using a ContentProvider.

    The great thing about Android is that it is Open Source, so nothing prevents you from going to search in the Android apps for similar scenarios. This is what I usually do in such situations. The ContactsProvider.java is a good example. It's a bit complex but working through it may give some insights on how to use joins within ContentProviders. If you do not want to download the source you may found it on GitHub:

    https://github.com/android/platform_packages_providers_contactsprovider/blob/master/src/com/android/providers/contacts/ContactsProvider2.java

    Good luck :)

    0 讨论(0)
提交回复
热议问题