Logo Icon Logo
A Crowd-sourced Cookbook on Writing Great Android® Apps
GitHub logo Twitter logo OReilly Book Cover Art

Introduction: GUI Alerts

Author: Ian Darwin
Published? true
FormatLanguage: WikiFormat

Problem:

N/A

Discussion:

User interface toolkits as diverse as Java Swing, Apple Macintosh, Microsoft Windows and browser JavaScript all feature the ubiquitous "pop up menu", usually in the window-frame version and the context (in-window) form. Android follows this, with some variations to be expected due to the smaller screens used on many devices, e.g., pop-up or context menus cover a large portion of the screen. As well, frame-anchored menus appear at the bottom of the screen rather than the top.

Those other window systems also feature the ubiquitous "dialog", a window smaller than the main screen which pops up to notify you of some condition or occurrence, and asks you to confirm your acceptance, or asks you to make one of several choices, provide some information, etc.

Android provides a fairly standard Dialog mechanism. But it doesn't stop there. It provides a smaller, lighter "pop up" called a Toast. This only appears on screen for a few seconds, and fades away on its own. Intended for passive notification of low-importance events, it is often incorrectly used for error notification, although I advise against this usage.

And it doesn't stop there. Android also provides a "notification" mechanism, which allows you to put text and/or an icon in the notifications bar (top right of the screen in Gingerbread, bottom right in Honeycomb). A Notification can be optionally be accompanied by any combination of LED flashing, audio sounds, and device vibration.

Each of these interactive mechanisms is discussed in this chapter. The chapter proceeds in the same order as this introduction, from menus, to dialogs and toasts, to Notifications.

No records found.