在完成当前视图后,我想要在另一个视图上显示SnackBar。这是一个发送表单,所以当我点击发送按钮时,我希望SnackBar出现在其他活动上,因为发送表单将被关闭。这是代码:
final Snackbar snackSuccess = Snackbar.make(***ViewToModifyHere?***, "Signal successfully sent.", Snackbar.LENGTH_LONG)
.setAction("Action", null)
.setDuration(2500);
snackSuccess.setAction("Dismiss", new View.OnClickListener() {
@Override
public void onClick(View view) {
snackSuccess.dismiss();
}
});
snackSuccess.setActionTextColor(Color.GREEN);
snackSuccess.setCallback(new Snackbar.Callback() {
@Override
public void onDismissed(Snackbar snackbar, int event) {
super.onDismissed(snackbar, event);
if (event != DISMISS_EVENT_ACTION) {
}
}
});
snackSuccess.show();
finish();