1

I have added 4 activities to a tabhost widget. These work fine. The problem is that i have started a new activity from my of my activity that is present in the TabbedHost. This activity is started on a new screen i.e The tabs are no longer visible. How can i start a new activity and it remains within the tabbed host. I hope u understand what i mean?

Kind Regards, Mateen

AndroidDev
  • 15,993
  • 29
  • 85
  • 119

1 Answers1

1

Hah!! Thats the problem with Tabhost widget dude! They don't allow you to start another activity in the tabhost itself.

The way i worked around is save the state by assigning them to some variables and then change the whole contentView itself by calling the context.setContentView(R.layout.newLayout)...

Then after loading the contentView you'll have to override the

@Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
    //check if this has been called by your second view, if yes then
    //set the previous ContentView and assign the values accordingly
    //else super.onKeyDown(keyCode,event)
    }

Worked like a charm for me... you can also do the same thing by having a back button in the second view of yours... Its your call...

you can further refer here...

Community
  • 1
  • 1
JaVadid
  • 7,107
  • 13
  • 42
  • 54
  • @st0le... oh Thanx dude... u didnt give me an upvote so i thought mayb u didnt like the idea... :) – JaVadid Jun 25 '10 at 07:48