Good afternoon, the question arose how to make sure that the pop-up message was a confirmation, that is, with the OK button?
2 answers
Toast does not support OnClick , so the button will not work. You can solve your problem using Dialog'a or Snackbar'a .
- thanks, exactly Dialog. - Varg Sieg
- @VargSieg I was glad to help) - iFr0z
- I would also add that following Google's guideline, it is advisable to stop using Toast everywhere and use in-layout notifications (the same Snackbar). - Alexander
|
Toast + action = Snackbar
Snackbar .make(parentLayout, R.string.snackbar_text, Snackbar.LENGTH_LONG) .setAction(R.string.snackbar_action, myOnClickListener) .show(); // Don't forget to show! |
Snackbarwill suitSnackbar? material.google.com/components/snackbars-toasts.html - Jarvis_J