I’m looking for an alternative way to get the query parameter names from an android.net.Uri. getQueryParameterNames() require api level 11. I’d like to do the same for any lower level api.
I was looking at getQuery() which will return everything after the ‘?’ sign. Would the best way to go about this be to parse that string and search for everything before an ‘=’ and capture that? I simply do not know what query parameters will be presented every time.
I’m looking for an alternative way to get the query parameter names from an
Share
The only problem with APIs < 11 is that this method is not implemented. I guess the best idea is to look into Android source code and use implementation from API >= 11. This should get you absolutely identic functionality even on older APIs.
This one is from 4.1.1, modified to take Uri as a parameter, so you can use it right away:
If you want to dig into it yourself, here is the original code:
http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.1.1_r1/android/net/Uri.java?av=f