Skip to main content
3 of 5
Rollback to Revision 1
Ron Ziroby Romero
  • 9.5k
  • 8
  • 46
  • 67

Specify the ID in the <include>

<include layout="@layout/test" android:id="@+id/test1" /> 

Then use two findViewById to access fields in the layout

View test1View = findViewById(R.id.test1); TextView test1TextView = (TextView) test1View.findViewById(R.id.text); 

Using that approach, you can access any field in any include you have.

Ron Ziroby Romero
  • 9.5k
  • 8
  • 46
  • 67