A Sample Widget Application

So far, we have covered the theory and approach behind widgets. Let's create the sample widget whose behavior has been used as the example to explain widget architecture. We will develop, test, and deploy this Birthday Widget.

Each Birthday Widget instance will show a name, the date of the next birthday, and how many days from today until the birthday. It will also create an onClick area where you can click to buy gifts. This click will open a browser and take you to www.google.com.

The layout of the finished widget should look like Figure 25–5.

Image

Figure 25–5 Birthday Widget look and feel

The implementation of this ...

Get Pro Android 4 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.