Android アプリで AlertDialog ボックスを再利用します。
onCreateDialog() メソッドでダイアログを作成し、onPrepareDialog() メソッドで、次のコードを使用して PositiveButton のテキストを変更しようとしました。
alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, this.getString(R.string.add), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//Handler code
}
}
onclick リスナーは変更されていますが、ボタンのテキストは変更されていません。
Androidのバグですか、それとも何か間違っていますか?