I believe the built in Contacts app is using the "My Contacts" group,
not just all of the contents of the People table, etc.  Looks like (at
a quick glance) you are putting a record in People just fine, but not
also putting the record in the group.

You might find it easier to use the static
"creatPersonInMyContactsGroup" method on the Contacts.People class (or
one of the other static methods there to add an existing Person to the
group, etc).

http://code.google.com/android/reference/android/provider/Contacts.People.html


On Dec 10, 4:45 am, Abraham <[EMAIL PROTECTED]> wrote:
> HI All,
>
> I am facing a weird issue related to contacts.
>
> Issue:
> I'm able to insert a contact successfully to the phonebook from my
> application. But when I try verify the same by opening contacts
> application on SDK I'm not able to find this contact.
>
> My code for inserting contact
>       Cursor cur = managedQuery(People.CONTENT_URI, new String[]
> { People._ID }, People.NAME + "=? AND " + People.NUMBER + "=?", new
> String[] {contactName, contactNo }, null);
>
>                 if ((cur != null) && (cur.getCount() == 0)) {
>
>                     ContentValues values = new ContentValues();
>                     values.put(People.NAME, contactName);
>                     Uri uri = getContentResolver().insert
> (People.CONTENT_URI, values); // insert to People's table
>
>                     values.clear();
>                     values.put(Phones.PERSON_ID, ContentUris.parseId
> (uri));
>                     values.put(PhonesColumns.NUMBER, contactNo);
>                     values.put(PhonesColumns.TYPE,
> PhonesColumns.TYPE_MOBILE);
>                     getContentResolver().insert(Phones.CONTENT_URI,
> values); // insert to Phone's table.
>
> Am I missing or doing something wrong while insert opertion. How can I
> ensure that the newly added contact is visible when I launch my
> contacts application on SDK.
>
> Another observation:
> If I launch Contacts List view from my application by following code
> the contact added can be viewed.
>                 Intent intent = new Intent(Intent.ACTION_PICK,
> People.CONTENT_URI);
>                 startActivityForResult(intent, PICK_CONTACT_REQUEST);
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to