开发者

Possible to write custom content provider for existing system database?

Not sure of the absolute utility of this but seems as though it should be possible and useful.

Can you extend ContentProvider to provide URIs representing new queries (i.e., joins across multiple tables not specified by existing URIs) for an existing system database?

The alternative seems to be that I need to write a series of cursor queries then 开发者_如何学Gojoin them -- seems like a lot of unnecessary code duplication.

I have been trying this for the contacts database as an exercise, but no love so far.

The crux seems to be that I cannot open a database in another package during the setup phase.

Am I just completely out in left field here?

It's possible as I am new to both Java and Android.

Comments and/or pointers to relevant resources are appreciated.

Thanks,

Steve


Can you extend ContentProvider to provide URIs representing new queries (i.e., joins across multiple tables not specified by existing URIs) for an existing system database?

Not really, only because you don't have direct access to existing system databases, in terms of SQLite. Now, creating a ContentProvider that performs your joins for you, as a reusability measure, is certainly doable, though I would get worried about the performance overhead of multiple cross-process hops.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜