We have two AlertDialog
AlertDialog dialog1, dialog2;
both dialogs are created using AlertDialog.Builder .
How do I know which dialog is the source of an event in DialogInterface.OnClickListener ?
with one dialog we can do this:
AlertDialogInstance.setOnClickListener(myListener); //myListener public void onClick(DialogInterface arg0, int arg1) { switch (arg1) { case AlertDialog.BUTTON_NEGATIVE: // do something break; case AlertDialog.BUTTON_POSITIVE: // do something break; case AlertDialog.BUTTON_NEUTRAL: // do something break; } }
how to change this switch logic to handle multiple dialogs?
(Or, if there is a more efficient system for handling dialogs, besides callbacks of built-in buttons, what is it?)
source share