You should either use real, existing account name and type or null for
both.  If you are inserting into a google account,  you should also add it
to the MyContacts group.

On Apr 9, 2010 2:08 AM, "Gibson" <[email protected]> wrote:
> 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]<android-developers%[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.

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