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!
}
});
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…