enable checkbox events in Listview

listView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// When clicked, show a toast with the TextView text
Country country = (Country) parent.getItemAtPosition(position);
CheckBox cb=(CheckBox)view.findViewById(R.id.checkBox1);
cb.toggle();
country.setSelected(cb.isChecked());
Toast.makeText(getApplicationContext(),
“Clicked on Row: ” + country.getName(),
Toast.LENGTH_LONG).show();
}
});

 

http://developer.android.com/reference/android/widget/Checkable.html#toggle()