私が代わりにDialog
コンストラクタのAlertDialog.Builder
使用します。このような
AlertDilog ad = new AlertDialog.Builder(this).create();
ad.setTitle(R.string.app_name);
ad.setMessage(this.getString(R.string.dialog_message);
ad.setCancelable(true);
ad.setButton(AlertDialog.BUTTON1, this.getString(R.string.first_btn_label), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//Do something when the first button is pressed
dismissDialog(DIALOG_SOLVED);
}
});
ad.setButton(AlertDialog.BUTTON2, this.getString(R.string.second_btn_label), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//Do something when the second button is pressed
dismissDialog(DIALOG_SOLVED);
}
});
//You can even add a third button if you want to
/*
ad.setButton(AlertDialog.BUTTON3, this.getString(R.string.third_btn_label), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//Do something when the third button is pressed
dismissDialog(DIALOG_SOLVED);
}
});
*/
ad.show();
を? http://www.codeofaninja.com/2011/07/android-alertdialog-example.html – zapl