All this is simply a ListView with a Checkbox What I want to achieve is that by pressing the first element of the list in this case is 'English' do not press the checkbox and when ONLY press the Checkbox check the box
public class MainActivity extends AppCompatActivity {
//Arraylist para guardar los elementos selecionados
ArrayList<String> selectedItems = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ListView chl = (ListView)findViewById(R.id.checkable_list);
chl.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
String[] items = {"English","French","Chinese","Khmer"};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,R.layout.rowlayout,R.id.txt_lan,items);
chl.setAdapter(adapter);
//Al presionar un item
chl.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
}
});
}
}