Easiest way to launch webpage in android with an icon

David O'Sullivan picture David O'Sullivan · Aug 11, 2011 · Viewed 22.8k times · Source

We have a website that offers an e-mail service. We would like to create a fully fledged app for this but cannot afford this right now. In the mean time it would be great if we could give users an icon on their phones that will take them to a page formatted for mobile on the internet. So what I'd like to know is how can we get an icon on an android users phone that will simply launch a web link in a browser- does this have to be an app, is there an easier way, or am I over estimating how complicated it would be to make this as an app anyway?

Thanks in advance

Answer

Fernando Gallego picture Fernando Gallego · Aug 11, 2011

Create a new Android project (after following the SDK installation steps provided at http://developer.android.com)

on the directory /res/drawable-*dpi you have the laucher icons. Modify all of them.

In the main activity, delete all inside the onCreate method an put this:

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

This will open the android browser with the URL provided.