Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Batch Selection of bitmaps/ImageViews android

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'?

like image 522
Namratha Avatar asked Jun 16 '26 09:06

Namratha


1 Answers

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.

like image 91
Vinay S Shenoy Avatar answered Jun 18 '26 22:06

Vinay S Shenoy