简体   繁体   English

如何在Android 2.2上添加新联系人?

[英]How to add the new contacts on android 2.2?

I need to add the new contacts on android 2.2 version. 我需要在android 2.2版本上添加新联系人。

How to add the all fields like Firstname, Lastname, URL, Nickname, IM, Addresses and mobile number? 如何添加所有字段,例如名字,姓氏,URL,昵称,IM,地址和手机号码?

Take a look at: http://developer.android.com/resources/articles/contacts.html 看看: http : //developer.android.com/resources/articles/contacts.html

The process involves some steps, as you would insert the name contact+name first, then field by field. 该过程涉及一些步骤,因为您将首先插入名称contact + name,然后逐字段插入。

Example for phone number: 电话号码示例:

import android.provider.ContactsContract.CommonDataKinds.Phone;
...
ContentValues values = new ContentValues();
values.put(Phone.RAW_CONTACT_ID, rawContactId);
values.put(Phone.NUMBER, phoneNumber);
values.put(Phone.TYPE, Phone.TYPE_MOBILE);
Uri uri = getContentResolver().insert(Phone.CONTENT_URI, values);

Additionally, have a read here: http://developer.android.com/reference/android/provider/ContactsContract.CommonDataKinds.html 此外,请在此处阅读: http : //developer.android.com/reference/android/provider/ContactsContract.CommonDataKinds.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM