dimanche 3 janvier 2016

android get checkbox from right row in list view

in my android app i have a custom list view. in each row is an checkbox.

i would like to check / uncheck the checkbox with each touch on the same row and / or with an touch on a checkbox.

ListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

@Override

public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {

SelectCheckBox = (CheckBox) ListView.getChildAt(position).findViewById(R.id.SelectCheckBox);

SelectCheckBox.toggle();
            }
});

if i touch row 3, the checkbox in row 3 will be checked / unchcheck.

but how can i realize this, with an touch directly on the checkbox. i would like to give a toast feedback with "You checked Checkbox X" (X = row-number of Checkbox)




Aucun commentaire:

Enregistrer un commentaire