In the android I have the following URL
String url = "http://domain.com/page?parameter1=value1¶meter2=value2";
I would like to get the parameters of this URL
how do I do this in a simple way?
In the android I have the following URL
String url = "http://domain.com/page?parameter1=value1¶meter2=value2";
I would like to get the parameters of this URL
how do I do this in a simple way?
To do this you can use the class URLEncodedUtils
which is a utility class of android for URL
's
Do as follows:
String url = "http://domain.com/page?parameter1=value1¶meter2=value2";
List<NameValuePair> parameters = URLEncodedUtils.parse(new URI(url),"utf-8");
for (NameValuePair p : parameters) {
System.out.println(p.getName());
System.out.println(p.getValue());
}