Error in opening a new class on click of tab in Android application
<p>I am developing an Android application in which I have a tab bar.  I want that when I click on tab new class should open.  How do I implement this?  My main problem is when I pass the intent on clicking the tab.  Then it's crashing.</p>

<p>I am posting my Java: </p>

<pre><code>package com.solataire;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class MainActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

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

        TabSpec tabspec1 = tab_host.newTabSpec("TAB_1");
        tabspec1.setIndicator("Tab 1");
        tabspec1.setContent(R.id.first_tab);
        tab_host.addTab(tabspec1);

        TabSpec tabspec2 = tab_host.newTabSpec("TAB_2");
        tabspec2.setIndicator("Tab 2");
        tabspec2.setContent(R.id.second_tab);
        tab_host.addTab(tabspec2);

        TabSpec tabspec3 = tab_host.newTabSpec("TAB_3");
        tabspec3.setIndicator("Tab 3");
        tabspec3.setContent(R.id.third_tab);
        tab_host.addTab(tabspec3);

        tab_host.setCurrentTab(0);
    }
}
</code></pre>

<p>My XML file is: </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/tab_host"
        android:layout_width="fill_parent" android:layout_height="fill_parent"&gt;
        &lt;TabWidget android:layout_width="fill_parent"
            android:layout_height="wrap_content" android:id="@android:id/tabs"
            android:layout_gravity="bottom" /&gt;
        &lt;FrameLayout android:id="@android:id/tabcontent"
            android:layout_width="fill_parent" android:layout_height="fill_parent" &gt;
            &lt;LinearLayout android:id="@+id/first_tab"
                android:orientation="vertical" android:layout_width="fill_parent"
                android:layout_height="fill_parent" &gt;
                &lt;TextView android:layout_width="fill_parent"
                    android:layout_height="fill_parent" android:text="First Tab" /&gt;
                &lt;!-- Replace TextView with your layout content for this tab --&gt;
            &lt;/LinearLayout&gt;
            &lt;LinearLayout android:id="@+id/second_tab"
                android:orientation="vertical" android:layout_width="fill_parent"
                  android:layout_height="fill_parent" &gt;
                &lt;TextView android:layout_width="fill_parent"
                    android:layout_height="fill_parent" android:text="Second Tab" /&gt;
                &lt;!-- Replace TextView with your layout content for this tab --&gt;
            &lt;/LinearLayout&gt;
            &lt;LinearLayout android:id="@+id/third_tab"
                android:orientation="vertical" android:layout_width="fill_parent"
                android:layout_height="fill_parent" &gt;
                &lt;TextView android:layout_width="fill_parent"
                    android:layout_height="fill_parent" android:text="One More Tab" /&gt;
                &lt;!-- Replace TextView with your layout content for this tab --&gt;
            &lt;/LinearLayout&gt;
            &lt;LinearLayout android:id="@+id/edit_item_text_tab"
                android:orientation="vertical" android:layout_width="fill_parent"
                android:layout_height="fill_parent" /&gt;
        &lt;/FrameLayout&gt;
    &lt;/TabHost&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>Can anyone help me in this point?</p>
