Hello all i have a simple problem i have a alertDialog and i want it to show two buttons i have searched here but it seems the options before don't work anymore and are deprecated.
Anyone know the new way of doing this you can see my code below that doesn't work.
Button share = (Button) findViewById(R.id.btn_share);
share.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// call some other methods before that I guess...
AlertDialog alertDialog = new AlertDialog.Builder(PasswActivity.this).create(); //Read Update
alertDialog.setTitle("Uprgade");
alertDialog.setMessage("Upgrade Text Here");
alertDialog.setButton("Upgrade", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
});
alertDialog.setButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
});
alertDialog.show(); //<-- See This!
}
});
Adding Buttons
This should do the trick for you:
Alert dialog builder have an additional method called setButton2 and setButton3 which can also be used !
try this