How to dereference subactivity of TabActivity

100 Views Asked by At

My application is having 7 Activity inside a TabActivity so every activity is associated with one intent having TabActivity context.What I am observing that when i switch from one activity to another the my heap size increases that means my old Activity still exist in memory.I can not destroy it in onPause() as it will give force close .So how can I dereference it from memory. Everytime I go to new Tab my heap size increases which is now giving me problem.Am I passing wrong context .If not what is solution for my problem

public class Tabactivity extends TabActivity  {
/** Called when the activity is first created. */

TabHost tabHost;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

tabHost = getTabHost();

    Intent it1 = new Intent(this, ActivityA.class);//i am using "this" is it wrong
    // adding each tab details to tabhost
    tabHost.addTab(tabHost
            .newTabSpec("1")
            .setIndicator("A",
                    getResources().getDrawable(R.drawable.ActivityA))
            .setContent(it1));

    //I have shown only one activity ,like this i have 6 other activity 

}
0

There are 0 best solutions below