Essential Android Snackbar edit forum

Snackbar vs Toasts Which one should I use

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() {
            @Override
            public void onClick(View view) {
                //Return his picture
            }
        })
        .show();

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.


Table Of Contents
39 ACRA
49 Snackbar
64 Menu
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
217 Paint
231 AIDL
241 JCodec
243 Okio
255 Looper
  ↑ ↓ to navigate     ↵ to select     Esc to close