O'Reilly logo

Android Application Development For Dummies, 2nd Edition by Donn Felker, Michael Burton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with App Widgets in Android

A Home screen widget (or app widget) in Android is a special kind of view that can be embedded on your device’s Home screen. An app widget can accept user input via click events, and it can update itself regularly. A user can add an app widget to the Home screen by tapping the Applications button and then selecting Widgets. The result is shown in Figure 7-1.

Figure 7-1: Adding a widget to the Home screen.

9781118417454-fg0701.eps

To make the Silent Mode Toggle application more usable, build a Home screen widget for it so that users can add the widget to the Home screen. Tapping the widget changes the phone’s ringer mode automatically without having to open the application. The widget also updates its layout to indicate what state the phone is in, as shown in Figure 7-2.

Figure 7-2: The two states of the app widget.

9781118417454-fg0702.eps

Working with remote views

When you develop apps in Android, remember that it’s based on the Linux 2.6 kernel. Linux comes supplied with its own idioms (or “dialect”) about security, and the Android platform inherits them. For example, the Android security model is heavily based around the Linux user, file, and process security model.

remember.eps Because every Android ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required