Problems with URIMatcher for Android

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); 

However, choosing sUriMatcher goes over to the default case (Wired for exception). Any ideas why the template would not fit? (And yes, ROUTE_LIST is in cases for selection, there is a corresponding gap with it)

+4
source share
1 answer

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

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

Source: https://habr.com/ru/post/1487732/


All Articles