Skip to content

Instantly share code, notes, and snippets.

@tomoyamkung
Created June 11, 2013 06:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomoyamkung/5754933 to your computer and use it in GitHub Desktop.
Save tomoyamkung/5754933 to your computer and use it in GitHub Desktop.
[Android]AlertDialog のスニペット(キャンセル時のリスナー付き)。
new AlertDialog.Builder(this)
.setTitle("TITLE")
.setMessage("Message")
.setPositiveButton(
"OK",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// OK ボタンがタップされたときの処理
}
}
)
.setNegativeButton(
"NG",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// NG ボタンがタップされたときの処理
}
}
)
.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
// キャンセルされたときの処理
}
})
.show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment