Android Tabhost not working
<p>I'm trying to implment a tabhost in Android. I've done eveything correctly in terms of setting it up but when I run the page, I get a null pointer exception which does not display the tabhost control on my android phone and generates the following stack trace:</p>

<pre><code> Radio_Debug [Android Application]  
        DalvikVM[localhost:8604]    
            Thread [&lt;3&gt; main] (Suspended (exception NullPointerException))  
                TabHost.dispatchWindowFocusChanged(boolean) line: 295   
                LinearLayout(ViewGroup).dispatchWindowFocusChanged(boolean) line: 664   
                FrameLayout(ViewGroup).dispatchWindowFocusChanged(boolean) line: 664    
                LinearLayout(ViewGroup).dispatchWindowFocusChanged(boolean) line: 664   
                PhoneWindow$DecorView(ViewGroup).dispatchWindowFocusChanged(boolean) line: 664  
                ViewRoot.handleMessage(Message) line: 1819  
                ViewRoot(Handler).dispatchMessage(Message) line: 99 
                Looper.loop() line: 123 
                ActivityThread.main(String[]) line: 4363    
                Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]  
                Method.invoke(Object, Object...) line: 521  
                ZygoteInit$MethodAndArgsCaller.run() line: 860  
                ZygoteInit.main(String[]) line: 618 
                NativeStart.main(String[]) line: not available [native method]  
            Thread [&lt;17&gt; Binder Thread #4] (Running)    
            Thread [&lt;15&gt; Binder Thread #3] (Running)    
            Thread [&lt;13&gt; Binder Thread #2] (Running)    
            Thread [&lt;11&gt; Binder Thread #1] (Running)    
</code></pre>

<p>The java code is linked to the xml page code is as follows:</p>

<pre><code>import android.app.Activity;
import android.os.Bundle;
import android.widget.TabHost;


public class tabs extends Activity{


    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.tabmain);

        TabHost tabHost = (TabHost)findViewById(R.id.tabHost);
        tabHost.setup();


    }



}
</code></pre>

<p>The xml file layout which houses the tabhost control is as follows: </p>

<pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
    &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        &gt;
        &lt;TabHost android:id="@+id/tabHost" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt;

            &lt;LinearLayout android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"&gt;
                &lt;TabWidget android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@android:id/tabs"&gt;&lt;/TabWidget&gt;

                   &lt;FrameLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@android:id/tabcontent"&gt;

                    &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/tab1"&gt;


                    &lt;/LinearLayout&gt;
                    &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/tab2"&gt;


                    &lt;/LinearLayout&gt;
                    &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/tab3"&gt;


                    &lt;/LinearLayout&gt;
                    &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/tab4"&gt;


                    &lt;/LinearLayout&gt;

                &lt;/FrameLayout&gt;
            &lt;/LinearLayout&gt;
        &lt;/TabHost&gt;




    &lt;/LinearLayout&gt;
</code></pre>
