I want to get informed when Snackbar is closed.
In an activity I use Snackbar
and then I call another activity and I want to show Snackbar
and when it has been already closed want to startActivity(NextActivity)
.
How could I manage it?
Snackbar.make(view, "Some text", Snackbar.LENGTH_SHORT)
.setCallback(new Snackbar.Callback() {
@Override
public void onDismissed(Snackbar snackbar, int event) {
super.onDismissed(snackbar, event);
startActivity(this, NextActivity.class);
}
}).show();
Define an action
.setAction("Go To Next Activity", mOnClickListener);
define onClickListenet as follows:
mOnClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
snackBar.dismiss(); // to close the snackbar
// startActivity(nextActivityIntent)
}
};
More Info Here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With