1

I am building an alert dialog with a checkbox. Whenever I set the message to anything (even a short message like "my msg") the dialog only shows the title, and the cancel button. The middle body of the dialog is a blank white. Nothing is shown. The code is below. Any idea on why the dialog shows blank whitespace? Why won't it display my message?

     @Override
 protected Dialog onCreateDialog(int id){

     switch(id){
     case MY_DIALOG:
         return new AlertDialog.Builder(this)
         .setIcon(R.drawable.identification_icon)
         .setTitle("My Title")
         .setMessage("short msg")
         .setPositiveButton("OK", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub

            }
        })
        .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub

            }
        })
        .setMultiChoiceItems(ackOptions, ackOptChecked, new DialogInterface.OnMultiChoiceClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which, boolean isChecked) {
                // TODO Auto-generated method stub

            }
        }).create();
     }

     return null;
 }
Mr. Awesome
  • 575
  • 1
  • 6
  • 19

1 Answers1

0

You need to inflate your alert dialog box to make the required changes like adding your own checkbox . 1. define the xml you want for your alert dialog box to show 2. inflate the alert dialog box and use your defined xml

Sunny Kumar Aditya
  • 2,806
  • 4
  • 26
  • 38