I have a layout with multiple ImageViews, some of those images need to have the same onClickListener.
I would like my code to be flexible and to be able to get a collection of those Views, iterate and add the listeners at run-time.
Is there a method like findViewById that will return a collection of Views rather than just a single one?
I’ve finally wrote this method (Updated thanks to @SuitUp (corrected username)):
It will return all views that have
android:tag="TAG_NAME"attribute. Enjoy 😉