views:

18

answers:

1

I have read the Android UI trick 2 on Android developers, which tells people how to include a layout in another layout file multiple times, and give these included layouts different id. However, the sample here is overwriting the layout id, not the id of the views IN this layout. For example, if the workspace_screen.xml looks like this:

And I include it three times in another layout file. Do I end up with three TextViews with id firstText, and another three with secondText? Isn't there an id collision? And how do I find the secondText TextView in the third included layout with findViewById? What should I input in the findViewById method?

A: 

Sorry the xml looks like this:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView android:id="@+id/firstText"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="first"/>
<TextView android:id="@+id/secondText"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="second"/>

remove this answer and edit your question to include this XML
Ankit Jain