I'm trying to implement my own ContentProvider
based on few examples but I'm confused by different approaches in UriMAtcher
. For instance:
JavaDoc shows it with #
like this:
sURIMatcher.addURI("contacts", "people", PEOPLE);
sURIMatcher.addURI("contacts", "people/#", PEOPLE_ID);
sURIMatcher.addURI("contacts", "people/#/phones", PEOPLE_PHONES);
sURIMatcher.addURI("contacts", "people/#/phones/#", PEOPLE_PHONES_ID);
but in "iosched" reference app by Google it uses *
like this:
matcher.addURI(authority, "rooms", ROOMS);
matcher.addURI(authority, "rooms/*", ROOMS_ID);
matcher.addURI(authority, "rooms/*/sessions", ROOMS_ID_SESSIONS);
Can anybody explain the difference of these two approaches ?
Refer official docs : http://developer.android.com/reference/android/content/UriMatcher.html.
public void addURI (String authority, String path, int code)
Added in API level 1 Add a URI to match, and the code to return when this URI is matched. URI nodes may be exact match string, the token "*" that matches any text, or the token "#" that matches only numbers.