Good afternoon, the question arose how to make sure that the pop-up message was a confirmation, that is, with the OK button?

  • one
    Look, maybe Snackbar will suit Snackbar ? material.google.com/components/snackbars-toasts.html - Jarvis_J
  • @Abrog Petrovich It's not that ( - Varg Sieg
  • If you are given an exhaustive answer, mark it as correct by checking the box to the left of the answer. - iramm

2 answers 2

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! 

Taken from here