title: Hide a tab in the TabHost in Android
body: <pre><code>if( ......)
      {
  
  
          tabHost.getTabWidget().getChildAt(0).setVisibility(View.GONE);
                      //to hide the first tab in the TabHost
  
      }
  </code></pre>
  
  <p>Is there anything wrong with this code ? The application crashes when I add this code inside the onCreate() method..
  Any idea ?</p>
  
  <p>My LogCat :</p>
  
  <pre><code>05-31 22:03:38.471: E/AndroidRuntime(598): Caused by: java.lang.NullPointerException 05-31 22:03:38.471: E/AndroidRuntime(598): at swayam.dev.mushtouch.MushTouchActivity.setVisibilityControls(MushTouchActivity.j‌​ava:75) 05-31 22:03:38.471: E/AndroidRuntime(598): at swayam.dev.mushtouch.MushTouchActivity.onCreate(MushTouchActivity.java:220) 05-31 22:03:38.471: E/AndroidRuntime(598): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 05-31 22:03:38.471: E/AndroidRuntime(598): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
  </code></pre>
  
  <p>Also tried this code. Still keeps crashing.</p>
  
  <pre><code>getTabHost().getTabWidget().removeViewAt(0);
  </code></pre>