I am creating an Android application where I have a ListView that displays all of the applications that were installed in my mobile phone.
My ListView is customized,
make the checkbox non-focusable, and on list-item click do this, here codevalue is the position.
Arraylist selectedschools=new Arraylist();
lvPickSchool.setOnItemClickListener(new AdapterView.OnItemClickListener()
{
@Override
public void onItemClick(AdapterView> parent, View view, int codevalue, long id)
{
CheckBox cb = (CheckBox) view.findViewById(R.id.cbVisitingStatus);
cb.setChecked(!cb.isChecked());
if(cb.isChecked())
{
if(!selectedschool.contains(codevaule))
{
selectedschool.add(codevaule);
}
}
else
{
if(selectedschool.contains(codevaule))
{
selectedschool.remove(codevaule);
}
}
}
});