title: Get fragment in Tabhost is null
body: <p>I have made a tab container with TabHost,  the layout xml file is like below:</p>
  
  <pre><code>&lt;TabHost
      android:id="@android:id/tabhost"
      android:layout_width="match_parent"
      android:layout_height="match_parent" &gt;
  
      &lt;TabWidget
          android:id="@android:id/tabs"
          android:layout_width="match_parent"
          android:layout_height="wrap_content" &gt;
      &lt;/TabWidget&gt;
  
      &lt;FrameLayout
          android:id="@android:id/tabcontent"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_marginTop="60dip" &gt;
  
          &lt;fragment
              android:id="@+id/tab1"
              android:name="com.test.Tab1Fragment"
              android:layout_width="match_parent"
              android:layout_height="match_parent" /&gt;
  
          &lt;fragment
              android:id="@+id/tab5"
              android:name="com.test.Tab5Fragment"
              android:layout_width="match_parent"
              android:layout_height="match_parent" /&gt;
      &lt;/FrameLayout&gt;
  &lt;/TabHost&gt;
  </code></pre>
  
  <p>In MainActivity, I init and add tab into activity in <code>onCreate</code> callback like this,</p>
  
  <pre><code>tabHost = (TabHost) findViewById(android.R.id.tabhost);
  tabHost.setup(); 
  tabHost.addTab(tabHost.newTabSpec("tab1").setIndicator(mRes.getString(R.string.tab1)).setContent(R.id.tab1));
  tabHost.addTab(tabHost.newTabSpec("tab5").setIndicator(mRes.getString(R.string.tab5)).setContent(R.id.tab5));
  </code></pre>
  
  <p>On the tab changed, I want to find the current fragment, and do some init while current fragment is showing.</p>
  
  <pre><code>private OnTabChangeListener tabChangedListener = new OnTabChangeListener() {
          public void onTabChanged(String tabid) {
              Log.d(TAG, "tab changed " + tabid);
              currentTab = tabid;
              TabChangeCallback currentFragment = (TabChangeCallback) getFragmentManager().findFragmentByTag(currentTab);
              if(currentFragment != null) {
                  currentFragment.onTabChanged(currentTabIndex);
              } else {
                  Log.d(TAG, "get fragment null ");
              }   
          }
      };
  </code></pre>
  
  <p>Question is why <code>getFragmentManager().findFragmentByTag(currentTab)</code> is return null, and I couldn't call the fragment init code. thanks for your help.</p>