SnackBar Vs Toast

After Material Design was introduced in Android, lot many changes happened to Android UI components. Few of the existing components were enhanced and few new components were introduced for stunning UI experience.
Today we are going to discuss about one such new UI component: ‘SnackBars’ – You might have heard or seen in Apps at the bottom, which is introduced as a quick alternative for Toast.
In this post, following will be discussed:
  1. What is Toast?
  2. What is SnackBar?
  3. Difference between SnackBar and Toast.
  4. Usages of SnackBar and Toast

What is Snackbar?

[box type=”download”]
Snackbar is an Android design component introduced as part of Material Design. It provide lightweight feedback about an operation by showing a brief message at the bottom of the screen. Snackbar can contain an action with which we can ask the App ro perform action like ‘Undo’ etc.,
[/box]
Here is the quick snapshot of SnackBar being used in GMail App:
SnackBar
Reference: Android SnackBar

What is Toast?

[box type=”bio”]
A toast is another Androdi design component that exists even before Material Design was started followed in Android. It provides simple feedback about an operation in a small popup that can appear at any part of the App (Mostly at the bottom of the App).
[/box]
Snapshot of Toast goes here:

Difference between Toast and SnackBar

Diff #ToastSnackBar
1Toast was added in API Level 1SnackBar was added in API Level 23
2Basically Activity is not required (Can be shown on Android home or even above other apps)It can be showed inside an activity of the Applications
3It can’t perform an action based on User inputIt can perform an action
4It can’t be dismissed by swipingIt can be dismissed by swiping
5It can’t handle user input like Swipe, Click etc.,It can handle user input



Usage of Snackbar and Toast

SnackBar:

SnackBar can be used in the areas where a simple popup message needs to be displayed along with an option to perform action.
For Example: In GMail application, when you delete Mail, quick SnackBar display at the bottom with Message ‘1 Deleted’ with an action button ‘Undo’. On pressing the ‘Undo’ action button, the deleted mail will be restored.

Toast

Toast can be used in the areas where System messages need to be displayed.
For Example:
When your App tries to download JSON from remote server but it fails due to Server Timeout or No resource found, you just need to display the error message saying that ‘Error Occurred’. But understand the Toast message cannot be dismissed by swiping. If you still want to have the capability of dismissing it in your App, go for SnackBar.

Comments

Popular posts from this blog

Minimum Required SDK – Target SDK – Compile With

Styling Bottom Navigation

Set Up the AWS Mobile SDK for Android