I have 2 browsers installed on my Android device 1) default and 2) Chrome
When I run the following code I get a 'Complete action using' selector...
String url = "http://www.google.com/search?q=" + query;
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
The default Android browser works, in that a browser opens at the specified URL. However, when I open using Chrome browser, Chrome simply opens... it seems to ignore the specified URL.
Is this a problem with Chrome, or my code?
Cheers
The problem was my query variable. It appears Chrome did not accept the format of the query string, where the default Android browser did.
The get the code to work I had to URL encode the query...
query = URLEncoder.encode(query, "UTF-8");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With