Hi,

I try to use following code to insert a new contact into the
ContactsProvider. But I cannot see it in the native Contacts
application. Is there something wrong with my code?

        ContentValues values = new ContentValues();
        values.put(RawContacts.ACCOUNT_TYPE, "");
        values.put(RawContacts.ACCOUNT_NAME, "");
        Uri rawContactUri =
getContentResolver().insert(RawContacts.CONTENT_URI, values);
        long rawContactId = ContentUris.parseId(rawContactUri);
        values.clear();
        values.put(Data.RAW_CONTACT_ID, rawContactId);
        values.put(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE);
        values.put(StructuredName.DISPLAY_NAME, "test");

        getContentResolver().insert(Data.CONTENT_URI, values);

BR
Gibson

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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to