setCurrentTab Android
<p>i have 4 tabs on <strong>my main screen</strong>,    </p>

<p>main ( set to current ) , Call, Email, Web</p>

<p>When a user clicks on any of tab call, email or web, it starts making a call, or go to compose a email, or opens up the browser respectfully.</p>

<p><strong>Problem</strong> is, i want just three tabs  (Call, Email, Web) and <strong>i Dont want any tab to be selected by default</strong>, means they should only become active when a user Touch them..(a call or any service cant be main at all)</p>

<p>All java coding, XML file, and Manifest code is given below,</p>

<p><strong>XML File</strong> (tab_activity_layout)</p>

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

        &lt;TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
             /&gt;
                  &lt;FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:padding="5dp"&gt;&lt;/FrameLayout&gt;

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

<p><strong>Java Coding</strong> (MainTabActivity)</p>

<pre><code>package com.NVT.android;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

public class MainTabActivity extends TabActivity{

        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.tab_activity_layout);

            Resources res = getResources(); // Resource object to get Drawables
            TabHost tabHost = getTabHost();  // The activity TabHost
            TabHost.TabSpec spec;  // Resusable TabSpec for each tab
            Intent intent;  // Reusable Intent for each tab

            // Create an Intent to launch an Activity for the tab (to be reused)
            intent = new Intent().setClass(this, Main.class);

            // Initialize a TabSpec for each tab and add it to the TabHost
            spec = tabHost.newTabSpec("main").setIndicator("Main",
                              res.getDrawable(R.drawable.ic_tab_artists_grey))
                          .setContent(intent);
            tabHost.addTab(spec);

            TabHost host=getTabHost();

            host.addTab(host.newTabSpec("one")
                    .setIndicator("Call")
                    .setContent(new Intent(this, CallService.class)));

            host.addTab(host.newTabSpec("two")
                    .setIndicator("Email")
                    .setContent(new Intent(this, EmailService.class)));

            host.addTab(host.newTabSpec("three")
                    .setIndicator("Web")
                    .setContent(new Intent(this, WebService.class)));

        }

        }
</code></pre>

<p><strong>Manifest file</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.NVT.android"
      android:versionCode="1"
      android:versionName="1.0"&gt;
    &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;

            &lt;activity android:name=".Main"
                  android:label="@string/app_name"&gt;
&lt;!--            &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.MAIN" /&gt;
                &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
            &lt;/intent-filter&gt; --&gt;
        &lt;/activity&gt;

        &lt;activity android:name=".MainTabActivity"
                  android:label="@string/app_name"&gt;
              &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.MAIN" /&gt;
                &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
            &lt;/intent-filter&gt; 
        &lt;/activity&gt;


        &lt;activity android:name=".Courses"&gt;
        &lt;/activity&gt;
        &lt;activity android:name=".CampusMap"&gt;
        &lt;/activity&gt;
        &lt;activity android:name=".GettingHere"&gt;
        &lt;/activity&gt;
        &lt;activity android:name=".ILoveNescot"&gt;
        &lt;/activity&gt;


        &lt;activity android:name=".FurtherEducationCourses"&gt;
        &lt;/activity&gt;
        &lt;activity android:name=".HigherEducationCourses"&gt;
        &lt;/activity&gt;
        &lt;activity android:name=".EmployersTrainingCourses"&gt;
        &lt;/activity&gt;
        &lt;activity android:name=".WebService"&gt;
        &lt;/activity&gt;
        &lt;activity android:name=".CallService"&gt;
        &lt;/activity&gt;
        &lt;activity android:name=".EmailService"&gt;
        &lt;/activity&gt;








    &lt;/application&gt;
    &lt;uses-sdk android:minSdkVersion="9" /&gt;
&lt;uses-permission android:name="android.permission.CALL_PHONE"&gt;&lt;/uses-permission&gt;
&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
&lt;/manifest&gt; 
</code></pre>
