I have this Dialog with 4 items in it. And I need to make for example first item unselectable (unclickable), how can I do that?
String[] presets = { getString(R.string.string1), getString(R.string.string2), getString(R.string.string3), getString(R.string.string4) };
AlertDialog dialog;
AlertDialog.Builder builder = new AlertDialog.Builder(ListFragment.this.getActivity());
builder.setTitle(name);
builder.setItems(presets, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int position1) {
switch(position1) {
case 0:
//some code
break;
case 1:
//some code
break;
case 2:
//some code
break;
case 3:
//some code
break;
}
dialog.dismiss();
}
});
dialog = builder.create();
dialog.show();