Take a look at this post :
http://groups.google.com/group/android-developers/browse_thread/thread/18021dbd0dcbf1ae

--
Praline

On Mar 23, 10:56 pm, Diego Pino <[EMAIL PROTECTED]> wrote:
> If what you really want is to retrieve contact with id=1, you should
> provide an URI like "content://android.provider.people/1".
> People.CONTENT_URI provides you the first part of the URI ("content://
> android.provider.people"). Then, you just need to add which ID you
> want with something like this:
>
> Uri uri =
> ContentUris.withAppendedId(org.pinowsky.provider.Items.CONTENT_URI,
> rowID);
> Cursor c = getContentResolver().query(uri,PROJECTION, null, null);
>
> Did not try that code but it should be something like that...check the
> ApiSamples
>
> br
>
> On Mar 23, 4:30 am, xinexo <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
>
> > I'm trying to query contact by id with this simple code
>
> >     private static String[] PROJECTION = new String[] {
> >         People._ID, People.NAME, People.NUMBER
> >     };
>
> >                  Cursor c = getContentResolver().query(People.CONTENT_URI,
> > PROJECTION,
> >                                  People._ID + "=1", null, null);
>
> > and i got this exception...
>
> > ERROR/JavaBinder(545): android.database.sqlite.SQLiteException:
> > ambiguous column name: _id, while compiling: SELECT COUNT(*) FROM
> > (SELECT people._id AS _id FROM people LEFT OUTER JOIN phones ON
> > people.preferred_phone=phones._id LEFT OUTER JOIN presence ON
> > (presence.person=people._id) WHERE (_id=1))
>
> > if i changed People._ID + "=1" to People.NUMBER, it works!
>
> > Please help...
>
> > Thanks
>
> > xinexo
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to