[fusion_text]
Snackbar is one of the most interesting component added in material design. We can use this as a toast message or as a toast message with an action button. In most of the applications we see a “Retry” button in Snackbar when the application unable to reach the internet. The same can be implemented very easily programmatically as follows-
Snackbar mSnackbar = Snackbar.make(getView(), "Unable to connect", Snackbar.LENGTH_LONG)
.setAction("RETRY", new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(getView(), "CheckIn Cancelled", Snackbar.LENGTH_SHORT).show();
}
});
mSnackbar.show();
[/fusion_text]