Implicit Intent to view URL

android

Solution

You're not building your Uri correctly, when trying to concatenate 2 String, use this :

String s = "I'm a string variable";

String concatenated = s + " and I'm another String variable";

Now the content of concatenated is

I'm a string variable and I'm another String variable

If you do this :

String concatenated = "s + and I'm another String variable";

the content of concatenated is

s + and I'm another String variable

Secondly, why are you using a geo Uri ? This is for viewing locations. To view a website, just use the URL (and don't forget the "http://" part) :

String URL = "http://www.google.com";
browserIntent.setData(Uri.parse(URL));

Problem

I am new to Android, I want to create an Intent to view google website. My String is declared as follows: ``` static private final String URL = "http://www.google.com"; ``` and my Intent : ``` Intent browserIntent = new Intent(Intent.ACTION_VIEW); browserIntent.setData(Uri.parse("geo:+URL")); startActivity(browserIntent); ``` This code shows no errors in Eclipse, but I think it might be wrong.

Original source

Related problems