Select all items within ListView
android, listview
Solution
You can check listview items one by one:
for ( int i=0; i < listview.getAdapter().getCount(); i++) {
listview.setItemChecked(i, true);
}
If you only want to select what is on screen, then use `listview.getChildCount()`.
If you are using fragments, you will need to use `getListAdapter().getCount()`.
Problem
I am currently working on an Android project. I am using a ListView and using a context action bar and I am successfully selecting each item and showing a count of how many items have been selected within the list view. Within the context bar I have a menu option for `Select All` but I don't know how I can make sure that every item within the list view is selected. I can't seem to find anything on Google, anything about this type of thing and selectable ListViews seem to be very well hidden.