Posts Tagged ‘widget’

Why I haven’t written TwitToday for Android

Thursday, February 25th, 2010

(or “looking at the limitations of the Android home screen widgets framework”)

Twitter client for Windows MobileA couple of years ago, I wrote a Windows Mobile app called TwitToday : a Twitter widget for the “Today screen” (the default screen when the phone is on, with all apps closed or minimised).

The rationale was that it was useful to have a way to post a tweet quickly when you don’t want to have to wait for a full-blown client to start.

Or if you don’t want to incur the battery or memory cost of leaving a client running all the time.


A widget that doesn't work on AndroidAndroid has a “Home screen”, which is similar to the Today screen on Windows Mobile. And it has support for widgets. This led several people to ask me why I never ported TwitToday to Android.

The short answer is that I did try, but the current state of the widgets framework made it impossible.

I tried to write a TwitToday widget back when the Android widgets framework was first introduced in Android 1.5.

It all started quite well:

  1. I wrote the Android Service that would carry out the background task of posting a tweet. No problems there – it worked fine.
  2. I wrote the widget XML to define the GUI. This is what you can see running in the screenshot. And it works… sort of. It has a text box that you can type up to 140 characters into. And if you press the button, it causes a chunk of code to get invoked.

The problem came when I tried to link the two together: to get the Service that posts tweets to obtain the String from the text box in my widget.

This isn’t possible. Android’s widget framework as it currently stands is geared around displaying information to the user, not collecting user input.

(more…)