|
最近优化通讯簿读取程序。记录Google android通讯簿读取所涉及的内容。
字段和类别只列出程序所需要内容。
android获取的字段内容都存在data1、data2、data3等字段内
Cursor cur = contentResolver.query(ContactsContract.Data.CONTENT_URI, null, null, null, null);
查询参数可列字段、查询条件等。
1 地址相关
查询的记录
cur记录mimetype字段为
ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE
=“vnd.android.cursor.item/postal-address_v2”
内容字段:
public static final java.lang.String FORMATTED_ADDRESS = "data1";//英文地址格式
public static final java.lang.String CITY = "data7";
public static final java.lang.String STREET = "data4";
public static final java.lang.String REGION = "data8";
public static final java.lang.String POSTCODE = "data9";
type字段为地址分类
public static final int TYPE_HOME = 1;
public static final int TYPE_WORK = 2;
public static final int TYPE_OTHER = 3;
自定义分类type=0
2备注相关
cur记录mimetype字段为
ContactsContract.CommonDataKinds.Note.CONTENT_ITEM_TYPE=“vnd.android.cursor.item/note”
内容字段:
public static final java.lang.String NOTE = "data1";
3姓名相关
public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/name";
public static final java.lang.String DISPLAY_NAME = "data1";
public static final java.lang.String GIVEN_NAME = "data2";
public static final java.lang.String FAMILY_NAME = "data3";
4组织相关
public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/organization";
public static final java.lang.String COMPANY = "data1";
public static final java.lang.String TITLE = "data4";
type类别
public static final int TYPE_WORK = 1;
public static final int TYPE_OTHER = 2;
5邮件相关
public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/email_v2";
public static final java.lang.String DATA1 = "data1";
//注意data4读取不到数据
public static final java.lang.String DISPLAY_NAME = "data4";
类别
public static final int TYPE_HOME = 1;
public static final int TYPE_WORK = 2;
public static final int TYPE_OTHER = 3;
public static final int TYPE_MOBILE = 4;
6号码相关
public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone_v2";
public static final java.lang.String NUMBER = "data1";
public static final int TYPE_HOME = 1;
public static final int TYPE_MOBILE = 2;
public static final int TYPE_WORK = 3;
public static final int TYPE_FAX_WORK = 4;
public static final int TYPE_FAX_HOME = 5;
public static final int TYPE_PAGER = 6;
public static final int TYPE_OTHER = 7;
自定义0 |
|