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’?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.