Say I have a URL
http://example.com/query?q=
and I have a query entered by the user such as:
random word £500 bank
I found an easy solution to your question. I also wanted to use an encoded URL but nothing helped me.
http://example.com/query?q=random%20word%20%A3500%20bank%20%24
to use String example = "random word £500 bank $"; you can you below code.
String example = "random word £500 bank $";
String URL = "http://example.com/query?q=" + example.replaceAll(" ","%20");