Common URIs for Android systems
The URI of the Android system management contact is as follows:
ContactsContract.Contacts.CONTENT_URI managing a contact's URI
ContactsContract.CommonDataKinds.Phone.CONTENT_URI the URI of the phone that manages the contact
ContactsContract.CommonDataKinds.Email.CONTENT_URI the URI of the email that manages the contact
(Note: Contacts has two tables, respectively, Rawcontact and Data,rawcontact record the user's ID and name,
Where the ID column name is: contactscontract.contacts._id, the Name column is ContactContract.Contracts.DISPLAY_NAME, The foreign key ID of the telephone information table is ContactsContract.CommonDataKinds.Phone.CONTACT_ID, The phone number column name is: ContactsContract.CommonDataKinds.Phone.NUMBER.
Reference: http://blog.sina.com.cn/s/blog_90cdca4c01010zm4.html
The name of the email address bar in the data table is:
ContactsContract.CommonDataKinds.Email.DATA
The key bar is: ContactsContract.CommonDataKinds.Email.CONTACT_ID)
The ContentProvider URI provided by Android for multimedia is as follows:
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI audio files stored on an SD card
MediaStore.Audio.Media.INTERNAL_CONTENT_URI audio files stored on the phone's internal memory
MediaStore.Audio.Video.INTERNAL_CONTENT_URI video on your phone's internal memory
Image file contents on SD card
MediaStore.Images.Media.INTERNAL_CONTENT_URI image on the internal memory of the phone
MediaStore.Images.Media.EXTERNAL_CONTENT_URI Video on SD card
(Note: The picture's display name bar: Media.display_name, the picture's detailed description column is: media.description
Where to save the picture: Media.data
SMS Uri:content://sms
SMS Uri:content://sms/outbox in the Sending box
(corresponding column name address, subject (title), time)
Query contacts in Contacts?
Cursor CR =getcontentresolver (). query (ContactsContract.Contacts.CONTENT_URI, NULL, null,null, NULL);
What if we just want to get the phone number?
Cursor phone = cr.query (Contactscontract.commondatakinds.phone.content_uri,null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + "=" +contactid, null, NULL);
Replace the above statement with the following:
Cursor phone = cr.query (Contactscontract.commondatakinds.phone.content_uri,null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + "=" +contactid + "+" + Contactscontract.commondatakinds.phone.type+ "=" + ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE, null,null);
ContactsContract.CommonDataKinds.Phone.TYPE represents the type of contact phone, which corresponds to the following:
Type_mobile: Mobile phone number
Type_home: Residential Phone
Type_work: Company Phone
Finally remember to read the contact's API in the Androidmanifest.xml statement:
<uses-permissionandroid:name= "Android.permission.READ_CONTACTS"/>
Common URIs for Android systems