Created
January 22, 2012 05:59
-
-
Save aztack/1655842 to your computer and use it in GitHub Desktop.
alert dialog with 2 buttons android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void AlertDialog() { | |
AlertDialog.Builder builder = new Builder(Main.this); | |
builder.setMessage("确认退出吗?"); | |
builder.setTitle("提示"); | |
builder.setPositiveButton("确认", new OnClickListener() { | |
@Override | |
public void onClick(DialogInterface dialog, int which) { | |
dialog.dismiss(); | |
Main.this.finish(); | |
} | |
}); | |
builder.setNegativeButton("取消", new OnClickListener() { | |
@Override | |
public void onClick(DialogInterface dialog, int which) { | |
dialog.dismiss(); | |
} | |
}); | |
builder.create().show(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment