I have an activity with a list fragment in it that has a layout with a checkbox for each row. I set the onclick
xml attribute for the checkbox and do the following for testing
public void onBoxClick(View v){
checkedItems = listview.getCheckedItemPositions();
int checkedItemsCount = checkedItems.size();
}
checkedItemsCount
comes back 0
, I thought to get what items that are checked you use the listview.getCheckedItemPositions()
but it is not so how do I know what is checked in the list?
this is my listfragment creation
@Override
public void onActivityCreated(Bundle state){
super.onActivityCreated(state);
listview = getListView();
listview.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
listview.setItemsCanFocus(false);
setEmptyText("No Bowlers");
registerForContextMenu(getListView());
populateList();
}