开发者

How to join a ContentResolver Cursor with a Database Cursor?

I get records from the system by quering a ContentResolver. I maintain the order of the items in the database. So I want to display the items in the order taken from my database.

How do I merge these two informations?

EDIT 1

I am looking after an alternative way now. As what I ideally want is:

  • get order of contacts by a custom order held in my database (this involves joining CR with my DB cursor, and doing an order by, later seams it's not possible with CursorJoiner)
  • but there is more, if the join is not unique I want to sort by contact's name as last measure

which is impossible using Cursor and Joiners, because of the missing feature of order bys, also I need to return a Cursor, as I will be using the in an ExpandableList

Also this translated开发者_StackOverflow中文版 to TSQL it would look like

select * from contactsdata 
left join category on contactsdata.catid=category.id
order by category.pos asc, contact.display_name asc

So I am looking now after an alternative.

I have in mind to load in a temporary DB table all data from CR, then do the query on the temporary table where I can join tables and do order bys? How does this sound to you?


Take a look at CursorJoiner.

If that doesn't work, you can roll your own equivalent with a fair amount of pain, whiskey, or both.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜