2

In Android application, which one should be prefered - toast notification or alert dialog? Or better, where should we use toasts and where should we use dialogs?

Personally I would use toast for basic notices like "You were logged in" etc but I would go with dialogs for messages like "You need to be logged in to..." which are kind of warning messages and more important for user to know.

7

The Android docs provide some guideance around toasts, notifications and dialogs.

The main difference between toasts and dialogs is that toasts provide feedback unobtrusively whereas dialogs demand an immediate response.

Toasts

A toast provides simple feedback about an operation in a small popup. It only fills the amount of space required for the message and the current activity remains visible and interactive. For example, navigating away from an email before you send it triggers a "Draft saved" toast to let you know that you can continue editing later. Toasts automatically disappear after a timeout.

Notifications

A toast would not be appropriate if the user is expected to respond because it only appears briefly and cannot be recalled. In this situation, the Android docs recommend using a Notification.

If user response to a status message is required, consider instead using a Notification.

Modal dialogs

Alerts in modal dialogs should be used whenever an explicit response is needed from the user, and that response is needed before anything else can happen.

A dialog does not fill the screen and is normally used for modal events that require users to take an action before they can proceed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.