Skip to content Skip to sidebar Skip to footer

Opening URL On Android Web Browser Causes Google Search

I'm having a slight problem opening a certain URL in the browser. First of all I use the following code to launch the browser: Intent browserIntent = new Intent(Intent.ACTION_VIEW,

Solution 1:

There is unwanted equal signs in the query part of your http URI. Such signs have a specific meaning as delimiters in the form &parameter=value. This equal signs represents padding values (0, 1 or 2) from your base64 encoding.

You can either

  • remove them because your base64 server decoder won't bother reconstructing them, or

  • percent encode them (with all other reserved characters).

In android you can use percent encode this way:

String value = URLEncoder.encode("annoying values with reserved chars &=#", "utf-8");
String url = "http://stackoverflow.com/search?q=" + value;

The RFC 2396 is now deprecated but that is what URI.parse() is based on as stated by the documentation:

uriString an RFC 2396-compliant, encoded URI


Post a Comment for "Opening URL On Android Web Browser Causes Google Search"