DEV Community

Cover image for Android Simplified. Toasts vs Snackbars
Tristan Elliott
Tristan Elliott

Posted on • Updated on

Android Simplified. Toasts vs Snackbars

Introduction

  • At the best of times the Android documentation can be overwhelming and confusing, at the worst of times it is very overwhelming and very confusing. This series hopes to boil down topics and make them less complex.

What is a Toast?

  • 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. Toasts automatically disappear after a timeout. You are probably already familiar with toasts because YouTube tutorials are full of them.

  • When reading the documentation for a Toast, which can be found HERE. It lists some alternatives to using a toast and it mentions using a snackbar for a better user experience

What is a Snackbar ?

  • Well, the documentation,which can be found HERE, actually states, Snackbars provide lightweight feedback about an operation. They show a brief message at the bottom of the screen on mobile and lower left on larger devices. Snackbars appear above all other elements on screen and only one can be displayed at a time. They automatically disappear after a timeout or after user interaction elsewhere on the screen, particularly after interactions that summon a new surface or activity. Snackbars can be swiped off screen

  • Which sounds strangely familiar to a toast.

What are the differences?

Toast:

  • Can’t be dismissed by swiping
  • Activity not required (Can show in android home or above other apps)
  • Can’t handle user input
  • Good for showing info messages to user

Snackbar:

  • Can dismiss by swiping
  • Can show inside an activity of your app
  • Can handle user input
  • Good for showing warning/info type messages to user that needs attention

Conclusion

  • If you are wondering which one to use, I would go with a Snackbar, mainly for the benefit of user experience.

  • Thank you for taking the time out of your day to read this blog post of mine. If you have any questions or concerns please comment below or reach out to me on Twitter.

Discussion (0)