Skip to content

September 27, 2012

Creating an Android Home Screen Widget

The home screen of a smartphone is precious real estate.  As users interact with their phone throughout the day, the icons and widgets on the home screen are constantly seen and ready to be interacted with at a moment’s notice.  Offering a widget for your app, service or web site is therefore a uniquely compelling way to to boost its visibility and “stickiness.”

One site that I’ve built is a small online community where people interact mainly via message boards and private messages.  I had already built a simple Android app that users could install to notify them whenever there is a new reply or message.  But to take this app to the next level, I needed to add a home screen widget.

This widget would stay updated with the most recent post made on the site as well as show the names of the users currently active.  In this way, the widget would effectively be a small window into what was going on at the site at any given moment.  Clicking the widget should take you directly to that latest post, logging you in automatically.  Finally, the widget should also visually alert you to any pending unread messages.  It should do all this while taking up as small a footprint as possible, as smartphone users are reluctant to give up too much of their screen to a single widget.

So there are a number of challenges, each of which must be resolved.  Which specific data must be displayed on the widget (we want as much as possible without forcing a larger footprint)?  How to retrieve that data from the web site?  How to keep the data fresh while minimizing battery and data usage?  How to take the user to the correct page when the widget is clicked?  How to make the widget visually appealing?  This last one is difficult, speaking as someone who is not a graphic designer, but I gave it a solid try. 🙂

So in the next few posts I’ll go into how I created an Android widget. But first please have a look at it:

Screen cap of Android Home Screen Widget

The footprint is 2×1 cells on the home screen.  The top half displays the latest post on the site, alongside the user’s icon, with the user’s name (“Example User”) followed by the message board it was posted to.  The bottom half lists the names of currently-active users. Had there been more than can fit on one line, the text here would scroll as a marquee.  Not shown is a hidden middle section that expands to notify of unread post replies and private messages.  All of this is displayed atop a semi-transparent 9-patch image that stretches to encompass the content.

More details on crafting this widget to follow.

Read more from Android Development

Share your thoughts, post a comment.

(required)
(required)

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments