How to nest a Layout in a Panel in a TabHost?

netkomm

Active Member
Licensed User
Longtime User
Hello,

I have the following issue:

- my program has a Tabhost controller
- in one of the layout called from the controller I placed a panel and in it I placed a ListView controller to list some data.

- When the user click on a row, the program should hide the the List View and show another Layout.

----
Problems:

- if I do that, when the user clicks on the back button the application closes (as the 1st layout "TabHost" is in control)

- If I open a second Activity, the initial (TabHost) is sent in foregroud and the activity shows full page (free from the TabHost) but in this case the back button works correctly...

Any suggestion on how to solve this? :BangHead:

Thank you! :)
 

JonPM

Well-Known Member
Licensed User
Longtime User
Capture the Back button key press in your main activity, and if any panel other than your main panel is currently visible, set it to not visible and make the main panel visible. Does this make sense? If your not familiar with capturing the back button, do a forum search as there are plenty of examples.
 
Upvote 0

netkomm

Active Member
Licensed User
Longtime User
Thanks for the reply. I did exactly like that.

The trapping of the Back button - for future use - has to keep in consideration the Current Tab and which panel is actually visible so that it can close the app when it's supposed too.
 
Upvote 0
Top