I have a custom widget (InfoIcon) with two views (Image view and Text View). I used this custom widget (InfoIcon) in my main layout file multiple times with individual Id (infoIconOne, infoIconTwo, infoIconThree) for the whole custom widget. Now want to listen only to the ImageView (inside Custom widget) onClick events and how to identify whether the ImageView click happens in infoIconOne/infoIconTwo/infoIconThree in parent layout?
InfoIcon:
<RelativeLayout
android:id="@+id/icon_layout">
<ImageView
android:id="@+id/image_icon"
android:src="@drawable/icon" />
<TextView
android:id="@+id/icon_info_text"/>
</RelativeLayout>
MainLayout:
<android.support.constraint.ConstraintLayout
android:id="@+id/parent_container">
<InfoIcon
android:id="@+id/iconOne"/>
<InfoIcon
android:id="@+id/iconTwo"/>
<InfoIcon
android:id="@+id/iconThree"/>
</android.support.constraint.ConstraintLayout>