i'm new in android programming, i had a problem for accessing view components inside navigation view. this is my code:
`
<android.support.design.widget.NavigationView android:id="@+id/nav_view"
android:layout_width="100dp" android:layout_height="match_parent"
android:layout_gravity="start" android:fitsSystemWindows="true">
<RelativeLayout
android:id="@+id/lay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="60dp"
android:background="#e4e4e4">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView3"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="@drawable/icon" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView4"
android:src="@drawable/icon2"
android:layout_below="@+id/imageView3"
android:layout_centerHorizontal="true" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView5"
android:src="@drawable/icon3"
android:layout_below="@+id/imageView4"
android:layout_centerHorizontal="true" />
</RelativeLayout>
</android.support.design.widget.NavigationView>`
i just want to access imageview inside navigationview. i've search in google and i got no solution on it. help me to fix it.
ImageView item1 = (ImageView)findViewById(R.id.imageView3);
item1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(), "just try", Toast.LENGTH_LONG).show();
}
});