App Widgets

App Widgets are small icon-like views into an application. They implement a subclass of the broadcast receiver for use in updating this view. Called widgets for short, they can be embedded into other applications, such as the home screen, by long clicking (in other words, pressing and holding) an empty area of the touchscreen.This displays a menu where a widget can be selected to install at that location. They can be removed by a long click on the widget and dragging to the trash can. In all, they require the following:

■ A view describing the appearance of the widget.This is defined in an XML layout resource file and contains text, background, and other layout parameters.

■ An App Widget provider that receives broadcast events and interfaces to the widget to update it.

■ Detailed information about the App Widget, such as the size and update frequency. Note that the home screen is divided into 4x4 cells and so a widget is often a multiple of a single cell size (which is 80x100dp in Portrait mode and 106x74dp in Landscape mode).

■ Optionally, an App Widget configuration activity can be defined to properly set any parameters of the Widget.This activity is launched upon creation of the Widget.

Was this article helpful?

0 0
Character Building Thought Power

Character Building Thought Power

Character-Building Thought Power by Ralph Waldo Trine. Ralph draws a distinct line between bad and good habits. In this book, every effort is made by the writer to explain what comprises good habits and why every one needs it early in life. It draws the conclusion that habits nurtured in early life concretize into impulses in future for the good or bad of the subject.

Get My Free Ebook

Post a comment