encode url needed as you want to access API, read data, send result back, or anything that using URL as the interface.
It’s easy, just use this code
try {
URLEncoder.encode("your url string here", "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}