我正在使用android,我想在AlertDialog
按钮上做一个事件。我想动态更改按钮上的文本,这是我的代码
AlertDialog.Builder alert = new AlertDialog.Builder(Soto_Betawi.this);
alert.setTitle("Payment");
alert.setMessage("Total Price : Rp. " + total);
final EditText input = new EditText(Soto_Betawi.this);
alert.setView(input);
alert.setPositiveButton("Change Due", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int which)
{
cash = Integer.parseInt(input.getText().toString());
change = cash - total;
//I want to set a text from the operation above in a text
}
});
alert.setNegativeButton("Close", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int which)
{
}
});
alert.setCancelable(true);
alert.create().show();