Чтобы получить результат AlertDialog, пожалуйста, попробуйте, как показано ниже,
String Result="";
public void Alert(String text, String title)
{
AlertDialog dialog=new AlertDialog.Builder(context).create();
dialog.setTitle(title);
dialog.setMessage(text);
if(!title.equals("") && !text.equals(""))
{
dialog.setButton("OK",
new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int whichButton)
{
Result="OK";
}
});
dialog.setButton2("Cancel",
new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int whichButton)
{
Result="Cancel";
}
});
}
dialog.show();
}
Спасибо.