display a snackbar android code example
Example 1: android create snackbar
Snackbar.make(fragmentView, text, Snackbar.LENGTH_LONG).setAction("Action", null /* replace with your action or leave null to just display text*/).show();
Example 2: android how to know when snackbar is done
snackbar.addCallback(new Snackbar.Callback() {
@Override
public void onDismissed(Snackbar snackbar, int event) {
if (event == Snackbar.Callback.DISMISS_EVENT_TIMEOUT) {
// Snackbar closed on its own
}
}
@Override
public void onShown(Snackbar snackbar) {
...
}
});