You have to make a custom layout for dialog in order to include buttons of your choice. Below is the example of how you can make it work:
public void showCustomDialog(){
try{
final Dialog d = new Dialog(act);
d.setContentView(R.layout.custom_layout_fordialog); // your custom dialog layout
d.setCancelable(false);
TextView status = (TextView) d.findViewById(R.id.result_status);
status.setText("Title of dialog");
TextView msg = (TextView) d.findViewById(R.id.result_msg);
msg.setText("body of dialog");
Button ok = (Button) d.findViewById(R.id.result_ok); // your button
ok.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// do whatever you want here
}
});
d.show();
}
catch(Exception e){
e.printStackTrace();
}
} // method end
-EDIT-
Please note that the above example is an alternative to AlertDialog
. You cannot use this as a child view in AlertDialog