Display text when clicked on the Button of AlertDialog in android <p>I'm working with android and I want to make an event on <code>AlertDialog</code> button. I want to change the text on the button dynamically, this is my code </p> <pre><code>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(); </code></pre>