开发者

Toast versus Dialog boxes: which to use when?

开发者 https://www.devze.com 2022-12-29 17:39 出处:网络
The answer could be subjective. The answer could be intuition. And I guess the answer could be found from the traditional modal versus non-modal debates.

The answer could be subjective. The answer could be intuition. And I guess the answer could be found from the traditional modal versus non-modal debates.

But in general how d开发者_StackOverflow中文版o you generally decide which one to go for? What are their use cases?

Thanks.


A Toast is mostly designed to inform the user of something that's not critical and that doesn't require interaction (and will fade by itself after a certain period of time like "Message saved"), so I'd use a Toast for just that. Also a Toast doesn't prevent the user from using the device/app, you can still activate e.g. underlying icons while the Toast is displayed. (This may depend on the device, but e.g. on the Droid this works.)

Dialogs mostly require the user to make a choice, or (like in a ProgressDialog) show a progress that doesn't require interaction but will keep the user from doing something else in the meantime, which can be important if e.g. you're doing calculations that would fail once the user changes the parameters before they are finished.

0

精彩评论

暂无评论...
验证码 换一张
取 消