How do you encode URL in Android ?
Encoding URL is very straightforward, simply call the encode method of the URL Encoder class on the String data that you want to encode. try { String url = "http://www.yoursite.com/blah"; String queryString = "param=1&value=2"; String encodedQueryString = URLEncoder.encode(queryString,"UTF-8"); String encodedQueryStringInBase64 = Base64.encodeToString(encodedQueryString, Base64.DEFAULT); encodedUrl = url + "?" + encodedQueryStringInBase64; Log.d("Enc URL: " + encodedurl); } catch (UnsupportedEncodingException e) { Log.e("Exception: " + e.getMessage()); } First: Choose an encoding (UTF-8 is generally a good choice) Transmitting end: Encode the string to bytes (e.g. text.getBytes(encodingName)) Encode the bytes to base64 using the Base64 class Transmit the base64 Receiving end: Receive the base64 Decode the base64 to bytes using the Base64 class Decode the bytes to a str