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
ImageView
You can use switch() for multiple widgets.
switch()
switch(viewobject.getId()) { case R.id.imageview1: /* ... */ break; case R.id.imageview2: /* ... */ break; }