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
-~----------~----~----~----~------~----~------~--~---