title: How to disable a tab bar item in android?
body: <p>I am making my first android app. I want to disable a tab bat item in my android app. I searched and found the following way to do that:</p>
  
  <pre><code> tabHost = (TabHost)findViewById(R.id.tabhost);
   tabHost.getTabWidget().getChildTabViewAt(your_index).setEnabled(false);
  </code></pre>
  
  <p>but its not working and i am getting following error:</p>
  
  <pre><code> 06-11 16:53:15.927: D/AndroidRuntime(8466): Shutting down VM
   06-11 16:53:15.927: W/dalvikvm(8466): threadid=1: thread exiting with uncaught exception (group=0x40028a00)
   06-11 16:53:16.037: D/dalvikvm(8466): GC_FOR_MALLOC freed 5350 objects / 347632 bytes in 98ms
   06-11 16:53:16.047: E/AndroidRuntime(8466): FATAL EXCEPTION: main
   06-11 16:53:16.047: E/AndroidRuntime(8466): java.lang.IllegalStateException: Could not execute method of the activity
   06-11 16:53:16.047: E/AndroidRuntime(8466):    at android.view.View$1.onClick(View.java:2072)
   06-11 16:53:16.047: E/AndroidRuntime(8466):    at android.view.View.performClick(View.java:2408)
   06-11 16:53:16.047: E/AndroidRuntime(8466):    at android.view.View$PerformClick.run(View.java:8817)
   06-11 16:53:16.047: E/AndroidRuntime(8466):    at android.os.Handler.handleCallback(Handler.java:587)
   06-11 16:53:16.047: E/AndroidRuntime(8466):    at android.os.Handler.dispatchMessage(Handler.java:92)
   06-11 16:53:16.047: E/AndroidRuntime(8466):    at android.os.Looper.loop(Looper.java:143)
   06-11 16:53:16.047: E/AndroidRuntime(8466):    at android.app.ActivityThread.main(ActivityThread.java:4914)
   06-11 16:53:16.047: E/AndroidRuntime(8466):    at java.lang.reflect.Method.invokeNative(Native Method)
   06-11 16:53:16.047: E/AndroidRuntime(8466):    at java.lang.reflect.Method.invoke(Method.java:521)
   06-11 16:53:16.047: E/AndroidRuntime(8466):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
   06-11 16:53:16.047: E/AndroidRuntime(8466):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
   06-11 16:53:16.047: E/AndroidRuntime(8466):    at dalvik.system.NativeStart.main(Native Method)
   06-11 16:53:16.047: E/AndroidRuntime(8466): Caused by: java.lang.reflect.InvocationTargetException
   06-11 16:53:16.047: E/AndroidRuntime(8466):    at com.eplinovo.runnoandroid.ActivityViewActivity.startClick(ActivityViewActivity.java:40)
   06-11 16:53:16.047: E/AndroidRuntime(8466):    at java.lang.reflect.Method.invokeNative(Native Method)
   06-11 16:53:16.047: E/AndroidRuntime(8466):    at java.lang.reflect.Method.invoke(Method.java:521)
   06-11 16:53:16.047: E/AndroidRuntime(8466):    at android.view.View$1.onClick(View.java:2067)
   06-11 16:53:16.047: E/AndroidRuntime(8466):    ... 11 more
   06-11 16:53:16.047: E/AndroidRuntime(8466): Caused by: java.lang.NullPointerException
   06-11 16:53:16.047: E/AndroidRuntime(8466):    ... 15 more
  </code></pre>
  
  <p>Why am i getting that? Thanks in advance.</p>