title: How to display the same layout for two different tabs in a TabHost?
body: <p>I'm working on an Android application with an Activity that uses a tab layout. There are two tabs which switch between the content being shown in some TextViews.</p>
  
  <p>This means that the two tab specifications point to the same layout (linear) for content, R.id.plantilla:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;TabHost xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@android:id/tabhost"
  android:layout_width="match_parent"
  android:layout_height="match_parent" &gt;
  
  &lt;LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical" &gt;
  
      &lt;TabWidget
          android:id="@android:id/tabs"
          android:layout_width="match_parent"
          android:layout_height="wrap_content" /&gt;
  
      &lt;FrameLayout
          android:id="@android:id/tabcontent"
          android:layout_width="match_parent"
          android:layout_height="match_parent" &gt;
  
          &lt;include layout="@layout/plantilla"/&gt;
  
  
      &lt;/FrameLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>But this only works if I switch to tab 2 and back to 1, i.e when the activity launches, the Layout "plantilla" can't be seen before tabs are changed. This is my problem.</p>
  
  <p>What's the most simple way to get around this?</p>
  
  <p>PD: I have tried to duplicate the line </p>
  
  <pre><code>&lt;include layout="@layout/plantilla"&gt;
  </code></pre>
  
  <p>in the tabhost xml, but in this case I can not access at the TextViews objects from the Java code using findViewById(R.id.someTextView); </p>