I show a Snackbar indefinitely. If the Bluetooth gets turned off, I want to hide it and show a new one to tell the users that they have to turn on the bluetooth. I dismiss the previous Snackbar before showing the new one, but still only the old Snackbar stays visible.
activeSnackbar.dismiss();
Snackbar.make(parent, "Bluetooth is off", Snackbar.LENGTH_INDEFINITE)
.setAction("Turn on", new View.OnClickListener() {
@Override
public void onClick(View v) {
BluetoothUtil.enableBluetooth(main);
}
}).show()
How can I make the old Snackbar disappear before showing the new one?