Saturday, October 2, 2010

How to Create a Custom Shortcut in Android

I'd been wanting a quick and easy way to compose a new email.  I tried my hand at whipping up a simple program that just installed a homescreen shortcut, but ran into namespace issues and didn't feel like putting more than an hour into it.  A few days later while messing around with my homescreen shortcuts/widgets and discovered how to use the Custom Shortcuts option available in some aftermarket launcher programs such as ADW Launcher and LauncherPro.  I've been running CyanogenMod 6 (based on Android 2.2/Froyo) for about a month now, which includes ADW, so my screenshots and examples will reflect that.

Any Android hacks you'd like to share in the comments?


How to Create a "New Email" Shortcut (Google Doc)

On the homescreen and either long-press on empty space or hit Menu, Add:

Select "Custom shortcut" from the list:

Select "Pick your activity":

Select "Activities" (this displays a list of all activities for every installed program):

Tap "Gmail" in the list:

Sift through the various activities available within the messaging app to find "Compose(.ComposeActivityGmail)":

Once you have selected the activity, it will return you to the Custom shortcut dialog.  
Enter a name, if you don't like the default, that will display on the homescreen (you can also change the icon by touching the default icon.)  Hit "Ok" when you are done:

Huzzah! You've added a Custom Shortcut


These instructions relate to semi-stock Android 2.2 your mileage may vary.  You can also do the same for pretty much any other application that has a "Compose..." or "Edit..." activity.  I was able to create a New Gmail, New Event, and New Tweet shortcut, just had to hunt the right activity down in the list (though this didn't work for the default messaging application).  Enjoy!

No comments:

Post a Comment