Showing Snackbar with action button in Android
void showSnackBarWithMessage(String message)
{
final Snackbar snack = Snackbar.make(yourView, message, 3000);
snack.getView().setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.colorPrimaryLight));
snack.setAction("OK", new View.OnClickListener() {
@Override
public void onClick(View view) {
snack.dismiss();
}
});
snack.show();
}