Create snack Bar - Android User Interface

Android examples for User Interface:SnackBar

Description

Create snack Bar

Demo Code

import android.content.Context;
import android.content.res.Configuration;
import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
import android.text.TextUtils;
import android.view.View;
import android.widget.Toast;

public class Main{
    public static void snackBar(@NonNull final View view,
            @NonNull final String msg) {

        Snackbar.make(view, msg, Snackbar.LENGTH_SHORT).show();
    }/*from w w w  .ja v  a  2 s.c om*/
    public static void snackBar(@NonNull final View view,
            @NonNull final String msg, @NonNull final String action,
            @NonNull final View.OnClickListener onClickListener) {

        Snackbar.make(view, msg, Snackbar.LENGTH_SHORT)
                .setAction(action, onClickListener).show();
    }
}

Related Tutorials