0

This is my code which I have used in one of my activivty.

    CharSequence[] values = {" one "," two"};
    AlertDialog alertDialog;
    AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
    builder.setTitle("Select Yout Time Format");
    builder.setSingleChoiceItems(values, 1, new 
    DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {

            switch(which)
            {
                case 0:

                    Toast.makeText(MainActivity.this, "First Item Clicked", Toast.LENGTH_LONG).show();
                    break;
                case 1:

                    Toast.makeText(MainActivity.this, "Second Item Clicked", Toast.LENGTH_LONG).show();
                    break;

            }
            alertDialog.dismiss();
        }
    });
    alertDialog = builder.create();
    alertDialog.show();

can anyone say why the above code is not displaying radio buttons in the Alertdialog. If anyone able to figure the error please give the answer as soon as possible.

Arunmani
  • 103
  • 1
  • 4

0 Answers0