- 浏览: 138066 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
bi_bao:
lz好啊 我也在做彩信的备份还原工作.您的附件还原代码很有用, ...
彩信 -
suifeng0211:
如果想不调用系统彩信界面,直接从后台发送,就比较麻烦了。但确定 ...
彩信发送。 -
atmus:
横竖看不懂
彩信发送。 -
smartdongdong:
这么好的帖子才看到!
MMS/SMS 入口 , -
A_L_85:
在LauncherModel中final Cursor c = ...
Android2.1_Launcher2学习笔记
联系人data表
类
android.provider.ContactsContract.Data
Constants for the data table, which contains data points tied to a raw contact. For example, a phone number or email address.
Data kinds
Data is a generic table that can hold all kinds of data. Sync adapters and applications can introduce their own data kinds. The kind of data stored in a particular row is determined by the mime type in the row. Fields from DATA1 through DATA15 are generic columns whose specific use is determined by the kind of data stored in the row. For example, if the data kind is Phone.CONTENT_ITEM_TYPE, then DATA1 stores the phone number, but if the data kind is Email.CONTENT_ITEM_TYPE, then DATA1 stores the email address.
ContactsContract defines a small number of common data kinds, e.g. ContactsContract.CommonDataKinds.Phone, ContactsContract.CommonDataKinds.Email etc. As a convenience, these classes define data kind specific aliases for DATA1 etc. For example, Phone.NUMBER is the same as Data.DATA1.
DATA1 is an indexed column and should be used for the data element that is expected to be most frequently used in query selections. For example, in the case of a row representing email addresses DATA1 should probably be used for the email address itself, while DATA2 etc can be used for auxiliary information like type of email address.
By convention, DATA15 is used for storing BLOBs (binary data).
Typically you should refrain from introducing new kinds of data for 3rd party account types. For example, if you add a data row for "favorite song" to a raw contact owned by a Google account, it will not get synced to the server, because the Google sync adapter does not know how to handle this data kind. Thus new data kinds are typically introduced along with new account types, i.e. new sync adapters.
查询操作
data表存储了大部分的联系人实际信息,他的每一个列的名字之所以这么难看(叫做data1~data15),是因为data表想要存储各种各样的联系人信息,同时不想让每个联系人的数据库列数太长。比如联系人信息里面,光名字就可以分为family name,mid name,nick name;光电话号码可以分为手机,家里,办公室,传真云云;光邮件可以分成这般这般这般那般,相当的纷繁复杂。如果每个信息都作为一个列出现在数据库,那就是硕大一个稀疏矩阵了。
所以data表这样的设计,更实用,也易于扩展;缺点是难看。
不过虽然难看,却不难查询,因为数据库查询的时候,根据data表的mimetype_id来检索需要的内容。
2.1里面,data表的mimetype支持这么十来种,这些不一定能在dump出来的数据库看到,因为一般用不到。。
对于这些不同类型的查询,有些可以用
ContactsContract.CommonDataKinds.*来完成,
比如Email
RawContacts表
类: android.provider.ContactsContract.RawContacts
Class Overview
Constants for the raw contacts table, which contains the base contact information per sync source. Sync adapters and contact management apps are the primary consumers of this API.
查询
关于ContactsContract.RawContactsEntity ,
说明: Constants for the raw contacts entities table, which can be though of as an outer join of the raw_contacts table with the data table. It is a strictly read-only table.
If a raw contact has data rows, the RawContactsEntity cursor will contain a one row for each data row. If the raw contact has no data rows, the cursor will still contain one row with the raw contact-level information and nulls for data columns.
Contacts表。
直接抄一些过来。。
long _ID read-only Row ID. Consider using LOOKUP_KEY instead.
String LOOKUP_KEY read-only An opaque value that contains hints on how to find the contact if its row id changed as a result of a sync or aggregation.
String DISPLAY_NAME read-only The display name for the contact. During aggregation display name is computed from display names of constituent raw contacts using a heuristic: a longer name or a name with more diacritic marks or more upper case characters is chosen.
long PHOTO_ID read-only Reference to the row in the ContactsContract.Data table holding the photo. That row has the mime type CONTENT_ITEM_TYPE. The value of this field is computed automatically based on the IS_SUPER_PRIMARY field of the data rows of that mime type.
int IN_VISIBLE_GROUP read-only An indicator of whether this contact is supposed to be visible in the UI. "1" if the contact has at least one raw contact that belongs to a visible group; "0" otherwise.
int HAS_PHONE_NUMBER read-only An indicator of whether this contact has at least one phone number. "1" if there is at least one phone number, "0" otherwise.
int TIMES_CONTACTED read/write The number of times the contact has been contacted. See markAsContacted(ContentResolver, long). When raw contacts are aggregated, this field is computed automatically as the maximum number of times contacted among all constituent raw contacts. Setting this field automatically changes the corresponding field on all constituent raw contacts.
long LAST_TIME_CONTACTED read/write The timestamp of the last time the contact was contacted. See markAsContacted(ContentResolver, long). Setting this field also automatically increments TIMES_CONTACTED. When raw contacts are aggregated, this field is computed automatically as the latest time contacted of all constituent raw contacts. Setting this field automatically changes the corresponding field on all constituent raw contacts.
int STARRED read/write An indicator for favorite contacts: '1' if favorite, '0' otherwise. When raw contacts are aggregated, this field is automatically computed: if any constituent raw contacts are starred, then this field is set to '1'. Setting this field automatically changes the corresponding field on all constituent raw contacts.
String CUSTOM_RINGTONE read/write A custom ringtone associated with a contact. Typically this is the URI returned by an activity launched with the ACTION_RINGTONE_PICKER intent.
int SEND_TO_VOICEMAIL read/write An indicator of whether calls from this contact should be forwarded directly to voice mail ('1') or not ('0'). When raw contacts are aggregated, this field is automatically computed: if all constituent raw contacts have SEND_TO_VOICEMAIL=1, then this field is set to '1'. Setting this field automatically changes the corresponding field on all constituent raw contacts.
int CONTACT_PRESENCE read-only Contact IM presence status. See ContactsContract.StatusUpdates for individual status definitions. Automatically computed as the highest presence of all constituent raw contacts. The provider may choose not to store this value in persistent storage. The expectation is that presence status will be updated on a regular basic.
String CONTACT_STATUS read-only Contact's latest status update. Automatically computed as the latest of all constituent raw contacts' status updates.
long CONTACT_STATUS_TIMESTAMP read-only The absolute time in milliseconds when the latest status was inserted/updated.
String CONTACT_STATUS_RES_PACKAGE read-only The package containing resources for this status: label and icon.
long CONTACT_STATUS_LABEL read-only The resource ID of the label describing the source of contact status, e.g. "Google Talk". This resource is scoped by the CONTACT_STATUS_RES_PACKAGE.
long CONTACT_STATUS_ICON read-only The resource ID of the icon for the source of contact status. This resource is scoped by the CONTACT_STATUS_RES_PACKAGE.
------------------------------------
关于查询。
数据库本身就复杂, 查询更是复杂, android提供的api试图把所有的查询变得简单,
不过就像我的程序一样,写了也就自己用,别人都不会用,甚至不愿意看。。。。。
这些api里面有不少整合操作,试图简化查询,因此很多uri的查询结果是很丰富很整合的。
使用URI:Contacts.CONTENT_URI
2 URI: ContactsContract.CommonDataKinds.Phone.CONTENT_URI
这个查询相当强大
3。URI:ContactsContract.Data.CONTENT_URI
传说中的data表。
列出来发现,跟刚才的phone查询一样的萨?
no。检索出来的内容数量不同。
刚才那个phone的,是这个data的子集,也就是从查询结果中,过滤去了mimetype是phone的部分。
哦。
4 URI: ContactsContract.RawContacts.CONTENT_URI
总而言之一句话,
源码全在 android.provider.ContactsContract , 看完了就不用看我这些唠叨了。。
我是看不完…………看着晕。
类
android.provider.ContactsContract.Data
Constants for the data table, which contains data points tied to a raw contact. For example, a phone number or email address.
Data kinds
Data is a generic table that can hold all kinds of data. Sync adapters and applications can introduce their own data kinds. The kind of data stored in a particular row is determined by the mime type in the row. Fields from DATA1 through DATA15 are generic columns whose specific use is determined by the kind of data stored in the row. For example, if the data kind is Phone.CONTENT_ITEM_TYPE, then DATA1 stores the phone number, but if the data kind is Email.CONTENT_ITEM_TYPE, then DATA1 stores the email address.
ContactsContract defines a small number of common data kinds, e.g. ContactsContract.CommonDataKinds.Phone, ContactsContract.CommonDataKinds.Email etc. As a convenience, these classes define data kind specific aliases for DATA1 etc. For example, Phone.NUMBER is the same as Data.DATA1.
DATA1 is an indexed column and should be used for the data element that is expected to be most frequently used in query selections. For example, in the case of a row representing email addresses DATA1 should probably be used for the email address itself, while DATA2 etc can be used for auxiliary information like type of email address.
By convention, DATA15 is used for storing BLOBs (binary data).
Typically you should refrain from introducing new kinds of data for 3rd party account types. For example, if you add a data row for "favorite song" to a raw contact owned by a Google account, it will not get synced to the server, because the Google sync adapter does not know how to handle this data kind. Thus new data kinds are typically introduced along with new account types, i.e. new sync adapters.
查询操作
// 1 Finding all Data of a given type for a given contact Cursor c = getContentResolver().query(Data.CONTENT_URI, new String[] {Data._ID, Phone.NUMBER, Phone.TYPE, Phone.LABEL}, Data.CONTACT_ID + "=?" + " AND " + Data.MIMETYPE + "='" + Phone.CONTENT_ITEM_TYPE + "'", new String[] {String.valueOf(contactId)}, null); // 2 Finding all Data of a given type for a given raw contact Cursor c = getContentResolver().query(Data.CONTENT_URI, new String[] {Data._ID, Phone.NUMBER, Phone.TYPE, Phone.LABEL}, Data.RAW_CONTACT_ID + "=?" + " AND " + Data.MIMETYPE + "='" + Phone.CONTENT_ITEM_TYPE + "'", new String[] {String.valueOf(rawContactId)}, null);
data表存储了大部分的联系人实际信息,他的每一个列的名字之所以这么难看(叫做data1~data15),是因为data表想要存储各种各样的联系人信息,同时不想让每个联系人的数据库列数太长。比如联系人信息里面,光名字就可以分为family name,mid name,nick name;光电话号码可以分为手机,家里,办公室,传真云云;光邮件可以分成这般这般这般那般,相当的纷繁复杂。如果每个信息都作为一个列出现在数据库,那就是硕大一个稀疏矩阵了。
所以data表这样的设计,更实用,也易于扩展;缺点是难看。
不过虽然难看,却不难查询,因为数据库查询的时候,根据data表的mimetype_id来检索需要的内容。
2.1里面,data表的mimetype支持这么十来种,这些不一定能在dump出来的数据库看到,因为一般用不到。。
* StructuredName.CONTENT_ITEM_TYPE // "vnd.android.cursor.item/name" * Phone.CONTENT_ITEM_TYPE // "vnd.android.cursor.item/phone_v2" * Email.CONTENT_ITEM_TYPE // "vnd.android.cursor.item/email_v2" * Photo.CONTENT_ITEM_TYPE // "vnd.android.cursor.item/photo" * Organization.CONTENT_ITEM_TYPE // ..... * Im.CONTENT_ITEM_TYPE * Nickname.CONTENT_ITEM_TYPE // "vnd.android.cursor.item/nickname" * Note.CONTENT_ITEM_TYPE * StructuredPostal.CONTENT_ITEM_TYPE * GroupMembership.CONTENT_ITEM_TYPE * Website.CONTENT_ITEM_TYPE * Event.CONTENT_ITEM_TYPE * Relation.CONTENT_ITEM_TYPE
对于这些不同类型的查询,有些可以用
ContactsContract.CommonDataKinds.*来完成,
比如Email
Uri uri = Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI, Uri.encode("bob")); Cursor c = getContentResolver().query(uri, new String[]{Email.DISPLAY_NAME, Email.DATA}, null, null, null);
RawContacts表
类: android.provider.ContactsContract.RawContacts
Class Overview
Constants for the raw contacts table, which contains the base contact information per sync source. Sync adapters and contact management apps are the primary consumers of this API.
查询
// 1, Finding all raw contacts in a Contact is easy: Cursor c = getContentResolver().query(RawContacts.CONTENT_URI, new String[]{RawContacts._ID}, RawContacts.CONTACT_ID + "=?", new String[]{String.valueOf(contactId)}, null); //There are two ways to find raw contacts within a specific account, // you can either put the account name and type in the selection or pass them as query parameters. // The latter approach is preferable, especially when you can reuse the URI: Uri rawContactUri = RawContacts.URI.buildUpon() .appendQueryParameter(RawContacts.ACCOUNT_NAME, accountName) .appendQueryParameter(RawContacts.ACCOUNT_TYPE, accountType) .build(); Cursor c1 = getContentResolver().query(rawContactUri, RawContacts.STARRED + "<>0", null, null, null); ... Cursor c2 = getContentResolver().query(rawContactUri, RawContacts.DELETED + "<>0", null, null, null); // The best way to read a raw contact along with all the data associated with it is by using the ContactsContract.RawContacts.Entity directory. // If the raw contact has data rows, the Entity cursor will contain a row for each data row. // If the raw contact has no data rows, the cursor will still contain one row with the raw contact-level information. Uri rawContactUri = ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId); Uri entityUri = Uri.withAppendedPath(rawContactUri, Entity.CONTENT_DIRECTORY); Cursor c = getContentResolver().query(entityUri, new String[]{RawContacts.SOURCE_ID, Entity.DATA_ID, Entity.MIMETYPE, Entity.DATA1}, null, null, null); try { while (c.moveToNext()) { String sourceId = c.getString(0); if (!c.isNull(1)) { String mimeType = c.getString(2); String data = c.getString(3); ... } } } finally { c.close(); }
关于ContactsContract.RawContactsEntity ,
说明: Constants for the raw contacts entities table, which can be though of as an outer join of the raw_contacts table with the data table. It is a strictly read-only table.
If a raw contact has data rows, the RawContactsEntity cursor will contain a one row for each data row. If the raw contact has no data rows, the cursor will still contain one row with the raw contact-level information and nulls for data columns.
Contacts表。
直接抄一些过来。。
long _ID read-only Row ID. Consider using LOOKUP_KEY instead.
String LOOKUP_KEY read-only An opaque value that contains hints on how to find the contact if its row id changed as a result of a sync or aggregation.
String DISPLAY_NAME read-only The display name for the contact. During aggregation display name is computed from display names of constituent raw contacts using a heuristic: a longer name or a name with more diacritic marks or more upper case characters is chosen.
long PHOTO_ID read-only Reference to the row in the ContactsContract.Data table holding the photo. That row has the mime type CONTENT_ITEM_TYPE. The value of this field is computed automatically based on the IS_SUPER_PRIMARY field of the data rows of that mime type.
int IN_VISIBLE_GROUP read-only An indicator of whether this contact is supposed to be visible in the UI. "1" if the contact has at least one raw contact that belongs to a visible group; "0" otherwise.
int HAS_PHONE_NUMBER read-only An indicator of whether this contact has at least one phone number. "1" if there is at least one phone number, "0" otherwise.
int TIMES_CONTACTED read/write The number of times the contact has been contacted. See markAsContacted(ContentResolver, long). When raw contacts are aggregated, this field is computed automatically as the maximum number of times contacted among all constituent raw contacts. Setting this field automatically changes the corresponding field on all constituent raw contacts.
long LAST_TIME_CONTACTED read/write The timestamp of the last time the contact was contacted. See markAsContacted(ContentResolver, long). Setting this field also automatically increments TIMES_CONTACTED. When raw contacts are aggregated, this field is computed automatically as the latest time contacted of all constituent raw contacts. Setting this field automatically changes the corresponding field on all constituent raw contacts.
int STARRED read/write An indicator for favorite contacts: '1' if favorite, '0' otherwise. When raw contacts are aggregated, this field is automatically computed: if any constituent raw contacts are starred, then this field is set to '1'. Setting this field automatically changes the corresponding field on all constituent raw contacts.
String CUSTOM_RINGTONE read/write A custom ringtone associated with a contact. Typically this is the URI returned by an activity launched with the ACTION_RINGTONE_PICKER intent.
int SEND_TO_VOICEMAIL read/write An indicator of whether calls from this contact should be forwarded directly to voice mail ('1') or not ('0'). When raw contacts are aggregated, this field is automatically computed: if all constituent raw contacts have SEND_TO_VOICEMAIL=1, then this field is set to '1'. Setting this field automatically changes the corresponding field on all constituent raw contacts.
int CONTACT_PRESENCE read-only Contact IM presence status. See ContactsContract.StatusUpdates for individual status definitions. Automatically computed as the highest presence of all constituent raw contacts. The provider may choose not to store this value in persistent storage. The expectation is that presence status will be updated on a regular basic.
String CONTACT_STATUS read-only Contact's latest status update. Automatically computed as the latest of all constituent raw contacts' status updates.
long CONTACT_STATUS_TIMESTAMP read-only The absolute time in milliseconds when the latest status was inserted/updated.
String CONTACT_STATUS_RES_PACKAGE read-only The package containing resources for this status: label and icon.
long CONTACT_STATUS_LABEL read-only The resource ID of the label describing the source of contact status, e.g. "Google Talk". This resource is scoped by the CONTACT_STATUS_RES_PACKAGE.
long CONTACT_STATUS_ICON read-only The resource ID of the icon for the source of contact status. This resource is scoped by the CONTACT_STATUS_RES_PACKAGE.
------------------------------------
关于查询。
数据库本身就复杂, 查询更是复杂, android提供的api试图把所有的查询变得简单,
不过就像我的程序一样,写了也就自己用,别人都不会用,甚至不愿意看。。。。。
这些api里面有不少整合操作,试图简化查询,因此很多uri的查询结果是很丰富很整合的。
使用URI:Contacts.CONTENT_URI
D/GN> columname of query uri( 4993): : Contacts.CONTENT_URI, D/GN> ( 4993): : <0>: times_contacted D/GN> ( 4993): : <1>: contact_status D/GN> ( 4993): : <2>: custom_ringtone D/GN> ( 4993): : <3>: has_phone_number D/GN> ( 4993): : <4>: contact_status_label D/GN> ( 4993): : <5>: lookup D/GN> ( 4993): : <6>: contact_status_icon D/GN> ( 4993): : <7>: last_time_contacted D/GN> ( 4993): : <8>: display_name D/GN> ( 4993): : <9>: in_visible_group D/GN> ( 4993): : <10>: _id D/GN> ( 4993): : <11>: starred D/GN> ( 4993): : <12>: contact_presence D/GN> ( 4993): : <13>: contact_status_res_package D/GN> ( 4993): : <14>: contact_status_ts D/GN> ( 4993): : <15>: photo_id D/GN> ( 4993): : <16>: send_to_voicemail
2 URI: ContactsContract.CommonDataKinds.Phone.CONTENT_URI
这个查询相当强大
D/GN> column name of query uri( 4993): : ContactsContract.CommonDataKinds.Phone.CONTENT_URI, D/GN> ( 4993): : <0>: data_version D/GN> ( 4993): : <1>: contact_id D/GN> ( 4993): : <2>: lookup D/GN> ( 4993): : <3>: data12 D/GN> ( 4993): : <4>: data11 D/GN> ( 4993): : <5>: data10 D/GN> ( 4993): : <6>: mimetype D/GN> ( 4993): : <7>: data15 D/GN> ( 4993): : <8>: data14 D/GN> ( 4993): : <9>: data13 D/GN> ( 4993): : <10>: data_sync1 D/GN> ( 4993): : <11>: data_sync3 D/GN> ( 4993): : <12>: data_sync2 D/GN> ( 4993): : <13>: data_sync4 D/GN> ( 4993): : <14>: account_type D/GN> ( 4993): : <15>: custom_ringtone D/GN> ( 4993): : <16>: status D/GN> ( 4993): : <17>: data1 D/GN> ( 4993): : <18>: data4 D/GN> ( 4993): : <19>: data5 D/GN> ( 4993): : <20>: data2 D/GN> ( 4993): : <21>: data3 D/GN> ( 4993): : <22>: data8 D/GN> ( 4993): : <23>: data9 D/GN> ( 4993): : <24>: group_sourceid D/GN> ( 4993): : <25>: data6 D/GN> ( 4993): : <26>: account_name D/GN> ( 4993): : <27>: data7 D/GN> ( 4993): : <28>: display_name D/GN> ( 4993): : <29>: in_visible_group D/GN> ( 4993): : <30>: contact_status_res_package D/GN> ( 4993): : <31>: is_primary D/GN> ( 4993): : <32>: contact_status_ts D/GN> ( 4993): : <33>: raw_contact_id D/GN> ( 4993): : <34>: times_contacted D/GN> ( 4993): : <35>: contact_status D/GN> ( 4993): : <36>: status_res_package D/GN> ( 4993): : <37>: status_icon D/GN> ( 4993): : <38>: contact_status_icon D/GN> ( 4993): : <39>: mode D/GN> ( 4993): : <40>: version D/GN> ( 4993): : <41>: last_time_contacted D/GN> ( 4993): : <42>: res_package D/GN> ( 4993): : <43>: _id D/GN> ( 4993): : <44>: status_ts D/GN> ( 4993): : <45>: dirty D/GN> ( 4993): : <46>: is_super_primary D/GN> ( 4993): : <47>: photo_id D/GN> ( 4993): : <48>: send_to_voicemail D/GN> ( 4993): : <49>: contact_status_label D/GN> ( 4993): : <50>: status_label D/GN> ( 4993): : <51>: starred D/GN> ( 4993): : <52>: contact_presence D/GN> ( 4993): : <53>: sourceid
3。URI:ContactsContract.Data.CONTENT_URI
传说中的data表。
D/GN> columname of query uri( 4993): : ContactsContract.Data.CONTENT_URI, D/GN> ( 4993): : <0>: data_version D/GN> ( 4993): : <1>: contact_id D/GN> ( 4993): : <2>: lookup D/GN> ( 4993): : <3>: data12 D/GN> ( 4993): : <4>: data11 D/GN> ( 4993): : <5>: data10 D/GN> ( 4993): : <6>: mimetype D/GN> ( 4993): : <7>: data15 D/GN> ( 4993): : <8>: data14 D/GN> ( 4993): : <9>: data13 D/GN> ( 4993): : <10>: data_sync1 D/GN> ( 4993): : <11>: data_sync3 D/GN> ( 4993): : <12>: data_sync2 D/GN> ( 4993): : <13>: data_sync4 D/GN> ( 4993): : <14>: account_type D/GN> ( 4993): : <15>: custom_ringtone D/GN> ( 4993): : <16>: status D/GN> ( 4993): : <17>: data1 D/GN> ( 4993): : <18>: data4 D/GN> ( 4993): : <19>: data5 D/GN> ( 4993): : <20>: data2 D/GN> ( 4993): : <21>: data3 D/GN> ( 4993): : <22>: data8 D/GN> ( 4993): : <23>: data9 D/GN> ( 4993): : <24>: group_sourceid D/GN> ( 4993): : <25>: data6 D/GN> ( 4993): : <26>: account_name D/GN> ( 4993): : <27>: data7 D/GN> ( 4993): : <28>: display_name D/GN> ( 4993): : <29>: in_visible_group D/GN> ( 4993): : <30>: contact_status_res_package D/GN> ( 4993): : <31>: is_primary D/GN> ( 4993): : <32>: contact_status_ts D/GN> ( 4993): : <33>: raw_contact_id D/GN> ( 4993): : <34>: times_contacted D/GN> ( 4993): : <35>: contact_status D/GN> ( 4993): : <36>: status_res_package D/GN> ( 4993): : <37>: status_icon D/GN> ( 4993): : <38>: contact_status_icon D/GN> ( 4993): : <39>: mode D/GN> ( 4993): : <40>: version D/GN> ( 4993): : <41>: last_time_contacted D/GN> ( 4993): : <42>: res_package D/GN> ( 4993): : <43>: _id D/GN> ( 4993): : <44>: status_ts D/GN> ( 4993): : <45>: dirty D/GN> ( 4993): : <46>: is_super_primary D/GN> ( 4993): : <47>: photo_id D/GN> ( 4993): : <48>: send_to_voicemail D/GN> ( 4993): : <49>: contact_status_label D/GN> ( 4993): : <50>: status_label D/GN> ( 4993): : <51>: starred D/GN> ( 4993): : <52>: contact_presence D/GN> ( 4993): : <53>: sourceid
列出来发现,跟刚才的phone查询一样的萨?
no。检索出来的内容数量不同。
刚才那个phone的,是这个data的子集,也就是从查询结果中,过滤去了mimetype是phone的部分。
哦。
4 URI: ContactsContract.RawContacts.CONTENT_URI
D/GN> columname of query uri( 4993): : ContactsContract.RawContacts.CONTENT_URI, D/GN> ( 4993): : <0>: times_contacted D/GN> ( 4993): : <1>: custom_ringtone D/GN> ( 4993): : <2>: contact_id D/GN> ( 4993): : <3>: sync4 D/GN> ( 4993): : <4>: sync3 D/GN> ( 4993): : <5>: sync2 D/GN> ( 4993): : <6>: sync1 D/GN> ( 4993): : <7>: deleted D/GN> ( 4993): : <8>: version D/GN> ( 4993): : <9>: account_name D/GN> ( 4993): : <10>: last_time_contacted D/GN> ( 4993): : <11>: aggregation_mode D/GN> ( 4993): : <12>: _id D/GN> ( 4993): : <13>: starred D/GN> ( 4993): : <14>: dirty D/GN> ( 4993): : <15>: sourceid D/GN> ( 4993): : <16>: send_to_voicemail D/GN> ( 4993): : <17>: account_type
总而言之一句话,
源码全在 android.provider.ContactsContract , 看完了就不用看我这些唠叨了。。
我是看不完…………看着晕。
评论
1 楼
zhaopian16
2011-04-14
S0S
我现在想让RawContacts 表查询完个cursor按姓名排序,怎么做???使用ContactsContract.Data.DISPLAY_NAME 他说找不到列名?我晕,数据库里明明有啊!!!!
我现在想让RawContacts 表查询完个cursor按姓名排序,怎么做???使用ContactsContract.Data.DISPLAY_NAME 他说找不到列名?我晕,数据库里明明有啊!!!!
相关推荐
该表保存了所有创建过的手机测联系人,每个联系人占一行,表里有一列标识该联系人是否被删除,该表保存了两个ID: RawContactID和ContactID,从而将contacts表和raw_contacts表联系起来。该表保存了联系人的...
该表保存了两个 ID:MimeTypeID 和 RawContactID,从而将 data 表和 raw_contacts 表联系起来。联系人的所有信息保存在列 data1 至 data15 中,各列中保存的内容根据 MimeTypeID 的不同而不同。 二、对联系人的基本...
标题“安卓联系人数据库”暗示我们将探讨的是与安卓设备上的联系人存储相关的SQLite数据库。 `contacts.db`是这个话题的核心,它是一个SQLite数据库文件,存储了安卓用户的联系人信息。这些信息通常包括姓名、电话...
首先,data表是联系人数据库中的一个关键表,它负责存储联系人相关的具体信息。每行数据代表联系人信息的一部分(例如电话号码、姓名或邮箱),而这一行并不直接关联到整个联系人,而是关联到raw_contacts表的ID,...
主要的数据库表包括`contacts`、`raw_contacts`、`data`等,它们通过独特的ID关联,构建出复杂的联系人数据模型。`contacts`表存储联系人的元信息,如姓名、显示名;`raw_contacts`表包含与特定数据源相关的联系人...
- **联系人详细信息**:进一步查询`raw_contacts`和`data`表来获取联系人的详细信息。 - **数据同步**:通过`data_sync1`至`data_sync4`字段,可以跟踪数据的变更情况,便于数据同步操作。 ### 总结 通过对Android...
Android系统的联系人管理功能是移动通信应用中的重要组成部分,本文将详细解析Android系统中与联系人相关的数据库架构与数据存储方式,帮助开发者更好地理解和掌握Android联系人数据库的工作原理及其实现细节。...
Android 2.2版本中对于联系人的管理主要通过`ContactsContract`类来进行,该类定义了一系列用于访问联系人数据库的标准接口。本文将详细介绍Android 2.2中的联系人表结构,包括`ContactsContract.RawContacts`、`...
`raw_contacts`表存储每个联系人的基本信息,而`data`表则包含了具体的联系人数据,如名字、电话号码、电子邮件等。`contacts`表用于维护联系人组和联系人的关系。 2. **ContentProvider机制** Android的Contacts...
3. **获取联系人详细信息**:通常,一个联系人可能有多个电话号码或电子邮件,我们需要遍历`ContactsContract.Data`表来获取这些信息: ```java String contactId = ...; // 获取到的联系人ID Cursor dataCursor ...
`contacts`表负责记录联系人的全局唯一标识符(ID),`raw_contacts`表存储每个原始联系人的信息,而`data`表则包含了具体的联系人字段,如姓名、电话号码、电子邮件地址等。这种设计允许系统高效地处理大量联系人...
我们需要提供`Data.RAW_CONTACT_ID`和`Data.GROUP_ROW_ID`,然后设置`Data.IS_SUPER_PRIMARY`为0,表示联系人不再属于该群组。 6. **更新群组信息** 更新群组信息涉及到对`ContactsContract.Groups`表进行`...
联系人数据分布在多个表中,如`ContactsContract.RawContacts`(原始联系人)、`ContactsContract.Data`(联系人数据项)和`ContactsContract.CommonDataKinds`(常见数据类型,如电话号码、电子邮件等)。...
其次,Android的联系人数据存储在SQLite数据库中,具体表可能包括`contacts`、`raw_contacts`、`data`等。开发者需要了解如何执行SQL查询来获取、修改这些数据,同时注意处理联系人分组、多号码等复杂情况。此外,...
`READ_CONTACTS`权限用于访问手机内置存储的联系人,而`READ_PHONE_STATE`则允许访问SIM卡信息。 接下来,我们可以通过ContentResolver和ContentProvider来获取通讯录数据。ContentProvider是Android系统提供的一个...
在Android平台上,通讯录是应用开发中的一个重要组成部分,它允许用户管理他们的联系人信息,包括姓名、电话号码、电子邮件地址等。本资源专注于Android通讯录的编程实践,旨在帮助开发者了解如何在Android应用中...
首先,需要获取联系人的ID,这可以通过`ContactsContract.Contacts`表中的`LOOKUP_KEY`字段来实现。然后,选定一个音乐文件,将其URI保存到`ContactsContract.Data`表中,对应的MIME类型是`vnd.android.cursor.item/...
本文实例讲述了Android编程操作联系人的方法。分享给大家供大家参考,具体如下: Android系统中的联系人也是通过ContentProvider来对外提供数据的,我们这里实现获取所有...raw_contacts:其中保存了联系人id data:和r