Android Utililty Methods URL Encode

List of utility methods to do URL Encode

Description

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

Method

Stringencode(String value)
encode
String encoded = "";
try {
    encoded = URLEncoder.encode(value, "UTF-8");
} catch (UnsupportedEncodingException ignore) {
StringBuffer buf = new StringBuffer(encoded.length());
char focus;
for (int i = 0; i < encoded.length(); i++) {
...
StringencodeURI(String encoded)
encode URI
encoded = encoded.replace("(", "%28");
encoded = encoded.replace(")", "%29");
encoded = encoded.replace("!", "%21");
encoded = encoded.replace("\'", "%27");
encoded = encoded.replace("*", "%2A");
return encoded;
Stringencode(String base)
encode
String encoded = Uri.encode(base);
return encodeURI(encoded);
Stringencode(String url)
encode
return URLEncoder.encode(url);
StringurlEncode(String url)
url Encode
if (url == null)
    return null;
try {
    return URLEncoder.encode(url, "UTF-8");
} catch (UnsupportedEncodingException e) {
    e.printStackTrace(); 
    return "";
StringencodeURL(String value)
encode URL
if (!isEmpty(value)) {
    return URLEncoder.encode(value, "UTF-8");
return "";
StringurlEncode(String string)
url Encode
return URLEncoder.encode(string, UTF8_ENCODING).replace("+", "%20");
StringgetURLEncodeStr(String url)
get URL Encode Str
try {
    url = URLEncoder.encode(url, "utf-8");
} catch (UnsupportedEncodingException e) {
return url;
StringgetUrlCode(String pageUrl)
get Url Code
try {
    String temp = getBaseUrl(pageUrl);
    temp = temp.substring(temp.indexOf("://") + 3).replace(".", "")
            .replace("/", "");
    return temp;
} catch (Exception e) {
return null;
...
StringurlEncode(String in)
url Encode
return URLEncoder.encode(in);