1

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();
tshepang
  • 12,111
  • 21
  • 91
  • 136
Adam
  • 2,152
  • 4
  • 35
  • 45

1 Answers1

0

in your xml make this for the widget you don't want it to be clickable

android:clickable="false"
William Kinaan
  • 28,059
  • 20
  • 85
  • 118