Machinarius
Machinarius

Reputation: 3731

Android URIMatcher problems

I have this URI

content://com.mycompany.data/routes?group=M01&office=BOCE&zone=EC01

And this rule

sUriMatcher.addURI("com.mycompany.data", "routes" + "?group=*&office=*&zone=*", ROUTE_LIST);

Yet the select on sUriMatcher goes to the default case (Wired to throw an exception). Any ideas why the pattern won't match? (And yes, ROUTE_LIST is on the cases for the select, with it's respective break)

Upvotes: 4

Views: 741

Answers (1)

Dalmas
Dalmas

Reputation: 26547

UriMatcher ignores the query string (anything after the ? in the Uri). Your content provider must handle parameters between slashes if you want to use this class. For example :

sUriMatcher.addURI("com.mycompany.data", "group/*", ...);
sUriMatcher.addURI("com.mycompany.data", "office/*", ...);
sUriMatcher.addURI("com.mycompany.data", "group/*/office/*", ...);

Upvotes: 6

Related Questions