4

I set up a tabhost with two activities and since I could not use TabActivity I used LocalActivityManager, but when I switch tabs onResume is not called for the Activities within the tabs. Here is my set up:

mlam = new LocalActivityManager(this, false);
mlam.dispatchCreate(savedInstanceState);
tabHost = (TabHost) findViewById(android.R.id.tabhost);
tabHost.setup(mlam);

I have the dispatchResume and dispatchPause placed in the proper places, but they only fire when the main tab activity gets an onResume or onPause. I tried to solve my issue by firing the dispatchResume on bab change but that seems to not be firing.

tabHost.setOnTabChangedListener(new OnTabChangeListener(){

    public void onTabChanged(String tabId) {

    mlam.dispatchResume();

     }

});

Does anyone know how to make sure the onResume is fired for the activities so I can update the content within the tabs as they are selected?

SunMan
  • 169
  • 2
  • 14

1 Answers1

2

You have to initialize mlam with the second parameter true: mlam = new LocalActivityManager(this, true);

And then only one activity is resume at the some time in the tabhost.

Jc Miñarro
  • 1,391
  • 10
  • 18