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

Creating an Alert Dialog Box

From time to time it may be necessary to alert the user to something that has happened. In the Task Reminder app, perhaps you want to display a welcome message and offer instructions on how to create a task. The Android system has a framework, built around dialog boxes that provide you with the implementation you may need.

Various types of dialog boxes are available:

check.png Alert: Notifies the user of an important occurrence. Also allows you to set the text value of a button and the action to be performed when it’s clicked. As a developer, you can provide the AlertDialog with a list of items to display, allowing the user to select from a list of items.

check.png Progress: Used to display a progress wheel or bar. This type of dialog box is created via the ProgressDialog class.

check.png Custom: A custom dialog box created and programmed by you, the master Android developer. You create a custom dialog box class by extending the Dialog base class or using custom layout XML files.

Seeing why you should work with dialog boxes

If you’ve never worked with an application that failed to alert you, or warn you appropriately, consider the example of an e-mail client not notifying you that ...

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