Start main activity wheneever tab is clicked in android
<p>I have three TAB which contains child activities, Problem is that when I clicked on any of one TAB it is not displays main activity..How can I display the main Activity within these of three TAB bar...anyone have solution for this.?</p>

<p>Thnx in Advance..
:)</p>

<p>Tabmain TabActivity</p>

<pre><code>    TabHost tabHost = getTabHost();
    TabSpec HomeSpec = tabHost.newTabSpec("Home");
    HomeSpec.setIndicator("Home", getResources().getDrawable(R.drawable.home));
    Intent HomeIntent = new Intent(this, HomeMediator.class);
    HomeSpec.setContent(HomeIntent);

    TabSpec SearchSpec = tabHost.newTabSpec("Search");
    SearchSpec.setIndicator("Search", getResources().getDrawable(R.drawable.search));
    Intent songsIntent = new Intent(this, SearchMediator.class);
    SearchSpec.setContent(songsIntent);

    TabSpec TreeInfoSpac = tabHost.newTabSpec("Tree Info");
    TreeInfoSpac.setIndicator("Botanical Name", getResources().getDrawable(R.drawable.carrot));
    Intent videosIntent = new Intent(this, BotaniacalMediator.class);
    TreeInfoSpac.setContent(videosIntent);

    tabHost.addTab(HomeSpec);
    tabHost.addTab(SearchSpec);
    tabHost.addTab(TreeInfoSpac);
    tabHost.setOnTabChangedListener(new OnTabChangeListener() {

        @Override
        public void onTabChanged(String tabId) {
            // TODO Auto-generated method stub

        }
    });
</code></pre>

<p>TabGroupActivity;</p>

<pre><code>private ArrayList&lt;String&gt; mIdList;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (mIdList == null) {
        mIdList = new ArrayList&lt;String&gt;();

    }
}


public void finishFromChild(Activity child) {
    LocalActivityManager manager = getLocalActivityManager();
    int index = mIdList.size() - 1;

    if (index &lt; 0) {
        finish();
        return;
    }

    manager.destroyActivity(mIdList.get(index), true);
    Log.i("Activity Finish:", manager.getCurrentId());
    mIdList.remove(index);
    index--;
    String lastId = mIdList.get(index);
    Intent lastIntent = manager.getActivity(lastId).getIntent();
    Window newWindow = manager.startActivity(lastId, lastIntent);
    setContentView(newWindow.getDecorView());
}

public void startChildActivity(String Id, Intent intent) {

    Window window = getLocalActivityManager().startActivity(Id,
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
    if (window != null) {
        mIdList.add(Id);
        setContentView(window.getDecorView());
        Log.i("Activity Start:", getLocalActivityManager().getCurrentId());
    }
}
</code></pre>

<p>HomeMediator</p>

<pre><code>public void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    group = this;
    super.onCreate(savedInstanceState);
    setContentView(R.layout.mediator);
    Intent LoginIntent = new Intent(HomeMediator.this, home.class);
    startChildActivity("Home", LoginIntent);
</code></pre>

<p>home</p>

<pre><code>@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.home);
    parentActivity = (TabGroupActivity) getParent();
}

public void btnInfo_Click(View v) {
    Intent i = new Intent(getParent(), records.class);
    i.putExtra("VAL", "BotanicalName");
    parentActivity.startChildActivity("Botanical", i);
}
</code></pre>
