Android Ö®ÍùͨѶ¼ÖÐÌí¼ÓÊý¾ÝºÍ²éѯÊý¾Ý¡¾×ª¡¿
http://blog.csdn.net/hosterZhu/archive/2011/01/20/6154461.aspx
?
?Ê×ÏÈ ÎÒÃÇÒªÔÚE:\android-sdk-windows\platforms\android-8\sources\ContactsProvider? ÕÒµ½Ô´Âë £¡
?ÒòΪandroid×Ô´øµÄͨѶ¼ҲÊÇͨ¹ýContentProvider¶ÔÍâ¹²ÏíÊý¾Ý¡£
?ÌùµãÔ´Â룺
?URI? ÕâÊÇContactsProvider2.java
?
view plaincopy to clipboardprint?
- static?{??
- ??????????
- ????????final?UriMatcher?matcher?=?sUriMatcher;??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"contacts",?CONTACTS);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"contacts/#",?CONTACTS_ID);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"contacts/#/data",?CONTACTS_DATA);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"contacts/#/suggestions",??
- ????????????????AGGREGATION_SUGGESTIONS);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"contacts/#/suggestions/*",??
- ????????????????AGGREGATION_SUGGESTIONS);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"contacts/#/photo",?CONTACTS_PHOTO);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"contacts/filter/*",?CONTACTS_FILTER);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"contacts/lookup/*",?CONTACTS_LOOKUP);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"contacts/lookup/*/#",?CONTACTS_LOOKUP_ID);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"contacts/as_vcard/*",?CONTACTS_AS_VCARD);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"contacts/as_multi_vcard/*",??
- ????????????????CONTACTS_AS_MULTI_VCARD);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"contacts/strequent/",?CONTACTS_STREQUENT);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"contacts/strequent/filter/*",??
- ????????????????CONTACTS_STREQUENT_FILTER);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"contacts/group/*",?CONTACTS_GROUP);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"raw_contacts",?RAW_CONTACTS);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"raw_contacts/#",?RAW_CONTACTS_ID);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"raw_contacts/#/data",?RAW_CONTACTS_DATA);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"raw_contacts/#/entity",?RAW_CONTACT_ENTITY_ID);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"raw_contact_entities",?RAW_CONTACT_ENTITIES);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"data",?DATA);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"data/#",?DATA_ID);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"data/phones",?PHONES);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"data/phones/#",?PHONES_ID);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"data/phones/filter",?PHONES_FILTER);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"data/phones/filter/*",?PHONES_FILTER);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"data/emails",?EMAILS);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"data/emails/#",?EMAILS_ID);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"data/emails/lookup/*",?EMAILS_LOOKUP);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"data/emails/filter",?EMAILS_FILTER);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"data/emails/filter/*",?EMAILS_FILTER);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"data/postals",?POSTALS);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"data/postals/#",?POSTALS_ID);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"groups",?GROUPS);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"groups/#",?GROUPS_ID);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"groups_summary",?GROUPS_SUMMARY);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?SyncStateContentProviderHelper.PATH,?SYNCSTATE);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?SyncStateContentProviderHelper.PATH?+?"/#",??
- ????????????????SYNCSTATE_ID);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"phone_lookup/*",?PHONE_LOOKUP);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"aggregation_exceptions",??
- ????????????????AGGREGATION_EXCEPTIONS);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"aggregation_exceptions/*",??
- ????????????????AGGREGATION_EXCEPTION_ID);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"settings",?SETTINGS);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"status_updates",?STATUS_UPDATES);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"status_updates/#",?STATUS_UPDATES_ID);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?SearchManager.SUGGEST_URI_PATH_QUERY,??
- ????????????????SEARCH_SUGGESTIONS);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?SearchManager.SUGGEST_URI_PATH_QUERY?+?"/*",??
- ????????????????SEARCH_SUGGESTIONS);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?SearchManager.SUGGEST_URI_PATH_SHORTCUT?+?"/*",??
- ????????????????SEARCH_SHORTCUT);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"live_folders/contacts",??
- ????????????????LIVE_FOLDERS_CONTACTS);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"live_folders/contacts/*",??
- ????????????????LIVE_FOLDERS_CONTACTS_GROUP_NAME);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"live_folders/contacts_with_phones",??
- ????????????????LIVE_FOLDERS_CONTACTS_WITH_PHONES);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"live_folders/favorites",??
- ????????????????LIVE_FOLDERS_CONTACTS_FAVORITES);??
- ????????matcher.addURI(ContactsContract.AUTHORITY,?"provider_status",?PROVIDER_STATUS);??
- ????}??
?
ÏîÄ¿Çåµ¥ÎļþÖÐ ÓÐContactsProvider2µÄÅäÖÃ
?
view plaincopy to clipboardprint?
- <provider?android:name="ContactsProvider2"?android:authorities="contacts;com.android.contacts"?android:label="@string/provider_label"?android:multiprocess="false"?android:readPermission="android.permission.READ_CONTACTS"?android:writePermission="android.permission.WRITE_CONTACTS">??
- ??<path-permission?android:pathPrefix="/search_suggest_query"?android:readPermission="android.permission.GLOBAL_SEARCH"?/>???
- padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px