List of usage examples for android.widget AbsListView isItemChecked
public boolean isItemChecked(int position)
From source file:com.gigathinking.simpleapplock.AppListFragment.java
@Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { AbsListView listView = ((AbsListView) getActivity().findViewById(R.id.lv_app_list)); int count = listView.getCount(); switch (item.getItemId()) { case R.id.delete_app: ArrayList<String> positions = new ArrayList<String>(); for (int i = 0; i < count; ++i) { if (listView.isItemChecked(i)) { positions.add(mList.get(i)); }/*from w ww . j a v a 2 s .c o m*/ } deleteApp(positions); mode.finish(); break; case R.id.select_all: if (!allItemsChecked) { for (int i = 0; i < count; ++i) { listView.setItemChecked(i, true); } allItemsChecked = true; } else { for (int i = 0; i < count; ++i) { listView.setItemChecked(i, false); } allItemsChecked = false; } break; } return true; }