Shakeeb Ayaz
Shakeeb Ayaz

Reputation: 6096

How to destroy the Activity on switching other Activity in TabActivity

I have 3 activity I want to destroy the earlier activity when i move to new activity in TabActivity

TabHosttabHost = getTabHost();


    Intent in1 = new Intent(this, ActivityA.class);
    // adding each tab details to tabhost
    tabHost.addTab(tabHost
            .newTabSpec("1")
            .setIndicator("TAB3",
                    getResources().getDrawable(R.drawable.tab1))
            .setContent(it5));
                    Intent it5 = new Intent(this, ActivityB.class);
    // adding each tab details to tabhost
    Intent in2 = new Intent(this, ActivityB.class);
    tabHost.addTab(tabHost
            .newTabSpec("2")
            .setIndicator("TAB3",
                    getResources().getDrawable(R.drawable.tab2))
            .setContent(it5));
                    Intent it5 = new Intent(this, ActivityC.class);
    // adding each tab details to tabhost
    Intent in3 = new Intent(this, ActivityC.class);
    tabHost.addTab(tabHost
            .newTabSpec("3")
            .setIndicator("TAB3",
                    getResources().getDrawable(R.drawable.tab3))
            .setContent(it5)); 

Upvotes: 1

Views: 522

Answers (1)

dd619
dd619

Reputation: 6170

Don't use Tab Activity then(TabActivity is deprecated now).

Simply create three activities and place three buttons at the bottom of each activity.

and while switching from one activity to another just call finish() after startActivity().

I am again saying not to use TabActivity because i have used it in one of my project an that was a headache for me.

Upvotes: 3

Related Questions