Android Utililty Methods URL Parameter Get

List of utility methods to do URL Parameter Get

Description

The list of methods to do URL Parameter Get are organized into topic(s).

Method

HashMappaserParams(String url)
paser Params
String params = url.substring(url.indexOf("?") + 1);
String[] arr = params.split("&");
HashMap<String, String> maps = new HashMap<String, String>();
for (String s : arr) {
    maps.put(s.substring(0, s.indexOf("=")),
            s.substring(s.indexOf("=") + 1));
return maps;
...
StringgetParamValue(String url, String param)
get Param Value
if ((url == null) || (param == null))
    return null;
StringBuffer sb = new StringBuffer();
try {
    String[] arrStr = split(new URL(url).getQuery(), "&");
    for (String str : arrStr) {
        String[] compare = split(str, "=");
        if (equals(param, compare[0])) {
...
StringgetValueFromQueryString(String url, String key)
get Value From Query String
int keyStPos = url.indexOf(key + "=") + key.length() + 1;
if (keyStPos == -1) {
    return "";
int keyEnPos = url.indexOf("&", keyStPos);
if (keyEnPos == -1) {
    keyEnPos = url.length();
return url.substring(keyStPos, keyEnPos);
HashMapparserURIQuery(String queryText)
parser URI Query
HashMap<String, String> resultMap = new HashMap<String, String>();
StringBuilder stringBuilder = new StringBuilder();
String key = null;
for (int index = 0; index < queryText.length(); index++) {
    char token = queryText.charAt(index);
    switch (token) {
    case '=':
        key = stringBuilder.toString();
...
URLgetQueryUrl(final String url)
get Query Url
URL queryUrl = null;
try {
    List<NameValuePair> queries = URLEncodedUtils.parse(
            new URI(url), "UTF-8");
    for (NameValuePair pair : queries) {
        if ("url".equals(pair.getName())) {
            queryUrl = new URL(pair.getValue());
} catch (Exception e) {
    e.printStackTrace();
return queryUrl;
StringqueryComponent(String url)
Grabs query component only from url.
int queryStart = url.indexOf("?");
if (queryStart == -1)
    return null;
return url.substring(queryStart + 1);