Android: How to create a launcher

Pierre picture Pierre · Jan 5, 2011 · Viewed 23k times · Source

I've never developed for Android before, so please consider me 100% dumb when you answer :)

I would like to create an application launcher that will open the default web browser to a given url. In other words, I want to make an icon with my website logo, and when you click on it, it opens the site in your default web browser.

Could someone direct me towards a tutorial/documentation page to achieve this? Or if it's really simple, maybe show me some code here?

Thanks for your time!

P

Answer

xil3 picture xil3 · Jan 5, 2011

If I understand what you need correctly, you could just create a simple app with just 1 activity and stick this in the onCreate:

Intent viewIntent = new Intent("android.intent.action.VIEW", Uri.parse("http://www.yourwebsite.com"));  
startActivity(viewIntent);

And here are some resources on creating a simple app:

http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/HelloWorld.html

And here is some info on how you can set your app icon:

http://www.connorgarvey.com/blog/?p=97