Reputation: 11527
Using Content Providers always come with hardly readable boilerplate where it's hard to spot programming errors.
Room persistence library from Android Architecture Components alleviate this issue, but it doesn't seem to work with Android's Content Providers out of the box.
Has anyone succeeded in using Calendar Provider or another Android's Content Provider with Room, obtaining more readable code? If yes, please answer and post your snippets, in Kotlin if you can ;)
Thanks for any help!
Upvotes: 2
Views: 606
Reputation: 1007474
it doesn't seem to work with Android's Content Providers out of the box.
Not only does it not work with ContentProvider
"out of the box", there is no practical way to have Room work with a ContentProvider
in its present state. The closest that you could get would be to have a SupportSQLite*
set of classes that attempt to map to ContentResolver
operations, but that's going to run into all sorts of problems (e.g., Room cannot create metadata tables).
It is not out of the question for a future edition of Room to support this, and there may already be libraries that offer Room-like approaches for accessing an external ContentProvider
.
Upvotes: 3