java - Extract parameter values from url android -


public static hashtable parseurlstring(string url) {     hashtable parameter = new hashtable();     list<namevaluepair> params = null;     try {         params = urlencodedutils.parse(new uri(url), "utf-8");         (namevaluepair param : params) {             if (param.getname() != null && param.getvalue() != null)                 parameter.put(param.getname(), param.getvalue());         }     } catch (urisyntaxexception e) {         e.printstacktrace();     }     return parameter; } 

the above method works me extract parameter name value hashtable in api 21+ namevaluepair , urlencodedutils deprecated best way can replace method?

in android, should never use urlencodedutils deprecated. alternative use uri class instead: retrieve query parameter keys using getqueryparameternames() iterate on them , retrieve each value using getqueryparameter().


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -