Suppose I have a grid of images, How do you select imageviews or bitmaps in batch mode? And how do you do a 'select all'?
Instead of adding ImageViews in your GridView, add Custom Layouts consisting of an ImageView and a Checkbox.
You can add a OnCheckedChangeListener to the Checkbox, so that whenever an image selected/deselected, you can add/remove the id of that image to an ArrayList.
Alternatively, when you select a button to perform an operation on selected items, you can iterate through the GridView and check if the checkbox is checked or not.
If you want to implement a "Select All" functionality, iterate through the GridView and set the CheckBox states to selected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With