Dianne - thanks for the confirmation. I had spent a while banging my
head on this issue, convinced that there ought to be an easy way if
only I found the right ContentProvider magic.
I can see that we will need to solve similar problems more than once,
and I would love to stay in the world of Cursors, which means the
CursorJoiner won't do it for us.
I have the slightly hazy idea that we could write our own Cursor that
took a pair of Cursors and a join expression, so as to do this in a
general way. That would be handy in all sorts of ways. Do you think
that would be practical ? Or is the absence of it in the SDK a clue
that it is harder than it looks ?
Thanks,
Richard
On Nov 26, 1:31 am, "Dianne Hackborn" <[EMAIL PROTECTED]> wrote:
> Correct, you can't directly do joins on the database. This is intentional,
> as the exact schema of the database can change over time, and a
> ContentProvider is intended to provide a more abstract mechanism for
> accessing it that can remain compatible as those changes occur.
>
>
>
> On Tue, Nov 25, 2008 at 7:03 AM, jarkman <[EMAIL PROTECTED]> wrote:
>
> > I've been looking at a similar problem. Something like this:
>
> > Cursor cursor = context.getContentResolver().query(
> > Contacts.GroupMembership.CONTENT_URI,
> > new String[]
> > {Contacts.GroupMembership._ID,Contacts.GroupMembership.PERSON_ID,
> > Contacts.GroupColumns.NAME},
> > Contacts.GroupMembership._ID =
> > Contacts.Groups.GROUP_MY_CONTACTS,
> > null, null);
>
> > will get you the IDs of the people in the group.
>
> > I'd love to make a cursor which also included the name of the person,
> > but as far as I know there is no way to do that with a single query.
>
> > That is, as far as I can tell, there's no way to do a join via the
> > content provider interface, and permissions prevent us from accessing
> > the contacts database directly via SQL calls. I really hope somebody
> > can prove me wrong!
>
> > Richard
>
> > On Nov 24, 11:14 am, Huebi <[EMAIL PROTECTED]> wrote:
> > > I'd like to get a Cursor for all contacts in the "My Contacts" group.
> > > I could not figure out how to do this with the ContentProvider. As far
> > > as I understood the table structure, I need to use the GroupMembership
> > > table, the Groups table (to get the ID of the "My Contacts" group and
> > > the People table to actually retrieve the contact data. Has anyone
> > > successfully solved this task?
>
> > > Thanks!
>
> --
> Dianne Hackborn
> Android framework engineer
> [EMAIL PROTECTED]
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support. All such questions should be posted on public
> forums, where I and others can see and answer them.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---