title: NPE when a TabActivity is started
body: <p>I have an activity that is formed of 2 tabs. The problem is, when I have this code:</p>
  
  <p><code>tabHost.setCurrentTab(0);</code></p>
  
  <p>I am getting the following exception:</p>
  
  <pre><code>03-14 01:06:39.520: ERROR/AndroidRuntime(588): java.lang.NullPointerException
  03-14 01:06:39.520: ERROR/AndroidRuntime(588):     at android.widget.TabHost.dispatchWindowFocusChanged(TabHost.java:295)
  03-14 01:06:39.520: ERROR/AndroidRuntime(588):     at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:661)
  03-14 01:06:39.520: ERROR/AndroidRuntime(588):     at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:661)
  03-14 01:06:39.520: ERROR/AndroidRuntime(588):     at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:661)
  03-14 01:06:39.520: ERROR/AndroidRuntime(588):     at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:661)
  03-14 01:06:39.520: ERROR/AndroidRuntime(588):     at android.widget.TabHost.dispatchWindowFocusChanged(TabHost.java:295)
  03-14 01:06:39.520: ERROR/AndroidRuntime(588):     at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:661)
  03-14 01:06:39.520: ERROR/AndroidRuntime(588):     at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:661)
  03-14 01:06:39.520: ERROR/AndroidRuntime(588):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1819)
  03-14 01:06:39.520: ERROR/AndroidRuntime(588):     at android.os.Handler.dispatchMessage(Handler.java:99)
  03-14 01:06:39.520: ERROR/AndroidRuntime(588):     at android.os.Looper.loop(Looper.java:123)
  03-14 01:06:39.520: ERROR/AndroidRuntime(588):     at android.app.ActivityThread.main(ActivityThread.java:4363)
  03-14 01:06:39.520: ERROR/AndroidRuntime(588):     at java.lang.reflect.Method.invokeNative(Native Method)
  03-14 01:06:39.520: ERROR/AndroidRuntime(588):     at java.lang.reflect.Method.invoke(Method.java:521)
  03-14 01:06:39.520: ERROR/AndroidRuntime(588):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
  03-14 01:06:39.520: ERROR/AndroidRuntime(588):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
  03-14 01:06:39.520: ERROR/AndroidRuntime(588):     at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>However, if I change the second tab to be displayed by default (I have only 2 tabs), as in:</p>
  
  <p><code>tabHost.setCurrentTab(1);</code></p>
  
  <p>everything is displayed correctly <strong>and</strong> I am able to switch between the tabs as well. This tells me that the tabs are configured correctly somehow, but then, why this behavior ?</p>