panthro
panthro

Reputation: 24061

Open URL in Android App?

I use the following to open a url from my app:

String url = "http://www.example.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);

But when I test it in the simulator, it goes back to eclipse and states source not found.

Whats going wrong?

Upvotes: 0

Views: 2867

Answers (1)

triad
triad

Reputation: 21497

I usually do it like this:

Uri uri = Uri.parse("http://www.example.com");

Intent intent = new Intent(Intent.ACTION_VIEW, uri);

startActivity(intent);

Also, does your simulator have the browser app installed on it?

Upvotes: 2

Related Questions