Click the confirm cancel dialog box for the event ., Click Event cancel dialog box
1 AlertDialog dialog = new AlertDialog. builder (this ). create (); 2 dialog. setTitle ("dialog box"); 3 dialog. setIcon (R. drawable. ic_launcher); 4 dialog. setButton (DialogInterface. BUTTON_POSITIVE, "OK", new DialogInterface. onClickListener () {5 6 @ Override 7 public void onClick (DialogInterface dialog, int which) {8 String s = data. get (pos); 9 10 data. remove (pos); 11 data. add (0, s); 12 13 mAdapter. notifyDataSetCha Nged (); 14 15 Toast. makeText (getApplicationContext (), "confirmed! ", 0 ). show (); 16} 17}); 18 19 dialog. setButton (DialogInterface. BUTTON_NEGATIVE, "cancel", new DialogInterface. onClickListener () {20 21 @ Override22 public void onClick (DialogInterface dialog, int which) {23 String s = data. get (pos); 24 25 Toast. makeText (getApplicationContext (), "canceled! ", 0). show (); 26} 27}); 28 dialog. show ();