I am displaying RadioButtons in a Sample AlertDialog.
AlertDialog levelDialog;
final CharSequence[] items = {" Easy "," Medium "," Hard "," Very Hard "};
// Creating and Building the Dialog
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Select The Difficulty Level");
builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
switch(item)
{
case 0:
// Your code when first option selected
break;
case 1:
// Your code when 2nd option selected
break;
case 2:
break;
case 3:
break;
}
// levelDialog.dismiss();
}
});
builder.setPositiveButton("Okay", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
levelDialog = builder.create();
levelDialog.show();
I am getting this as output
I need to disable the 3rd option "HARD". Means I want to display the item, but not selectable. It should be in disable mode.
Can it be implemented by modifying this code? Or Should I inflate custom layout and set it on the builder.setView()?