Amazon Gift Cards

Saturday, April 11, 2009

Open URL/Website from android

Here is a small piece of code to open a URL/Website from your application, place it on your class that has startActivity function, for example your class that extends Activity

String url = "http://almondmendoza.com/android-applications/";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);


Hope this helps.

15 comments:

Anonymous said...

Simple and effective!

AlexR said...

10x a lot!

Anonymous said...

Good solution. thx

Anonymous said...

nice !

android development said...

The code worked,interesting code, to open the url of a website from our application.

Anonymous said...

It cant be any better and neater than this !!!
Thanxxxx a bunch

Mumrik said...

Thank you very much!

Action Abbas said...

Thank you very much.

Anonymous said...

Thanks, very quick & effective, saved me time & trouble!

Anonymous said...

it worked...thanks...

Beagle Skywalker said...

Thank you for sharing!

I would like to know if is it posible hide the address toolbar?

Thanks again

SHAIKH FARHAN said...

Good work.....
How can we get string from Edittext and then allow go to the link.

Anonymous said...

Tks very much for you share your knowledge... This code helped me a lot.. It worked perfectly..

Anonymous said...

Thanks.

gordollanos said...

friend, thank you very much for this code has helped me a lot .... but I have a big question ... with this code automatically opens my browser with the website we build but I need a few seconds after you close and return to me activity ... thank you very much in what they can help after the Star activity count 2 seconds and finish him and put me into the app ... thanks for your help! =)