Snackbar vs Toasts Which one should I use

suggest change

Toasts are generally used when we want to display an information to the user regarding some action that has successfully (or not) happened and this action does not require the user to take any other action. Like when a message has been sent, for example:

Toast.makeText(this, "Message Sent!", Toast.LENGTH_SHORT).show();

Snackbars are also used to display an information. But this time, we can give the user an opportunity to take an action. For example, let’s say the user deleted a picture by mistake and he wants to get it back. We can provide a Snackbar with the “Undo” action. Like this:

Snackbar.make(getCurrentFocus(), "Picture Deleted", Snackbar.LENGTH_SHORT)
        .setAction("Undo", new View.OnClickListener() {
            public void onClick(View view) {
                //Return his picture

Conclusion: Toasts are used when we don’t need user interaction. Snackbars are used to allow users to take another action or undo a previous one.

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents