OnTabChangeListener Null Pointer
<p>I am attempting to create custom colors of the tabs in a TabHost. </p>

<p>I have impletmented <code>OnTabChangeListener</code> and the MainActivity loads up correctly. However when I click on a new tab I get a null pointer. Where is my error located? I cannot understand  what the issue is. </p>

<p>Here is the offending code loosely based off of <a href="http://www.androidpeople.com/android-tabhost-tutorial-%E2%80%93-part-2" rel="nofollow">this example</a></p>

<pre><code>@Override  
public void onTabChanged(String tabId) {  
     for(int i=0;i&lt;tabHost.getTabWidget().getChildCount();i++)
     {  
        tabHost.getTabWidget().getChildAt(i).setBackgroundDrawable(getResources().getDrawable(R.drawable.greygradient));  
     }
     tabHost.getTabWidget().getChildAt((tabHost.getCurrentTab())).setBackgroundDrawable(getResources().getDrawable(R.drawable.bluegradient));
}  
</code></pre>

<p>Here is the trace:</p>

<pre><code>06-20 14:27:42.770: E/AndroidRuntime(1490): java.lang.NullPointerException
06-20 14:27:42.770: E/AndroidRuntime(1490):     at com.company.app.MainActivity.onTabChanged(MainActivity.java:72)
06-20 14:27:42.770: E/AndroidRuntime(1490):     at android.widget.TabHost.invokeOnTabChangeListener(TabHost.java:359)
06-20 14:27:42.770: E/AndroidRuntime(1490):     at android.widget.TabHost.setCurrentTab(TabHost.java:344)
06-20 14:27:42.770: E/AndroidRuntime(1490):     at android.widget.TabHost$2.onTabSelectionChanged(TabHost.java:132)
06-20 14:27:42.770: E/AndroidRuntime(1490):     at android.widget.TabWidget$TabClickListener.onClick(TabWidget.java:456)
06-20 14:27:42.770: E/AndroidRuntime(1490):     at android.view.View.performClick(View.java:2485)
06-20 14:27:42.770: E/AndroidRuntime(1490):     at android.view.View$PerformClick.run(View.java:9080)
</code></pre>
