title: Fragment Tabhost Error: java.lang.IllegalStateException: No tab known for tag null When Internet Connection not available
body: <p>I Am first checking the internet connection and after that I am starting my Activity and I face this problem when I use the Tab Host.</p>
  
  <p>I am also put my adding tab host code in the try catch but it don't even catch the exception.</p>
  
  <p>XML Code:
      </p>
  
  <pre><code>&lt;android.support.v4.app.FragmentTabHost
      android:id="@android:id/tabhost"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:background="#999999"
  
      &gt;
  
      &lt;FrameLayout
          android:id="@android:id/tabcontent"
          android:layout_width="0dp"
          android:layout_height="0dp"
          android:layout_weight="0" /&gt;
  &lt;/android.support.v4.app.FragmentTabHost&gt;
  </code></pre>
  
  <p>My java Code</p>
  
  <pre><code>    cd = new ConnectionDetector(Alumni_MainActivity.this);
      // Check if Internet present
     if (!cd.isConnectingToInternet()) {
         // Internet Connection is not present
         alert.showAlertDialog(Alumni_MainActivity.this,
                 "Internet Connection Error",
                 "Please connect to working Internet connection", false);
         // stop executing code by return
         return;
     }
  
  
  
  
  
  try {
      tabHost = (FragmentTabHost) findViewById(android.R.id.tabhost);
      tabHost.setup(this, getSupportFragmentManager(), R.id.fragment_container);    
  
  
  
          addTab("Chat", R.drawable.chaticon, ChatRoom.class, tabHost,null);
          addTab("Contacts", R.drawable.contacticon, Memeber_view.class, tabHost, null);
          addTab("Gallery", R.drawable.gallery, Galler_View.class, tabHost, null);
  
          addTab("Event", R.drawable.event, EventList.class, tabHost,null);  
          addTab("More", R.drawable.moreicon, More.class, tabHost,null);
  } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
  }  
  </code></pre>
  
  <p><strong>Error:</strong>
  <code>08-20 10:02:04.195: E/AndroidRuntime(13462): FATAL EXCEPTION: main
  08-20 10:02:04.195: E/AndroidRuntime(13462): java.lang.IllegalStateException: No tab known for tag null
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at android.support.v4.app.FragmentTabHost.doTabChanged(FragmentTabHost.java:330)
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at android.support.v4.app.FragmentTabHost.onAttachedToWindow(FragmentTabHost.java:280)
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at android.view.View.dispatchAttachedToWindow(View.java:11988)
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2495)
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2502)
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2502)
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2502)
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2502)
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1363)
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1139)
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4879)
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:776)
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at android.view.Choreographer.doCallbacks(Choreographer.java:579)
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at android.view.Choreographer.doFrame(Choreographer.java:548)
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:762)
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at android.os.Handler.handleCallback(Handler.java:725)
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at android.os.Handler.dispatchMessage(Handler.java:92)
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at android.os.Looper.loop(Looper.java:153)
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at android.app.ActivityThread.main(ActivityThread.java:5311)
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at java.lang.reflect.Method.invokeNative(Native Method)
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at java.lang.reflect.Method.invoke(Method.java:511)
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
  08-20 10:02:04.195: E/AndroidRuntime(13462):    at dalvik.system.NativeStart.main(Native Method)</code></p>
  
  <p>Please help me I am struck.</p>
  
  <p>Thanks in Advance!!</p>