TabHost and new activities

JonPM

Well-Known Member
Licensed User
Longtime User
I am using TabHost, and on my main page I have many Buttons. Each button loads a new activity. My question is how do I load the activity underneath the TabHost buttons? Right now each activity essentially clears the screen and TabHost disappears. Do I have to recreate the TabHost in each activity? I was hoping for a simpler solution. Also trying to avoid recreating TabHost as this causes it to redraw on the screen and looks unnatural.
 

JonPM

Well-Known Member
Licensed User
Longtime User
What exactly do you want to do?
What is the TabHost for?
What are the different activities, called with the buttons, doing and what is displayed?

Best regards.

The first tab of the TabHost has a page which contains many buttons. Each button leads to a different & unique calculator (which doesn't share any coding with other calculators). Each of these buttons start the independent calculator activities. As of now when the new activity is started the TabHost disappears.
 
Upvote 0

JonPM

Well-Known Member
Licensed User
Longtime User
Hi.

Do you want each tab content to host a separate activity?

Not really. Page 1 of tabhost has many buttons that when clicked open different calculator activities. Page2 is settings and Page3 is a help page. My concern is just with page1.


Sent from my DROIDX
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I wouldn't use TabHosts.
As you already have a lot of buttons, I would make the selection of the Main, Settings and Help panels also with buttons.
I would work on the main activity with five panels:
- Toolbox panel with the 'general' buttons, always visible
- Main panel with the calculator selection buttons.
- Setup panel
- Help panel
- Calculator panel
The Main, Help and Setup panels are made visible or not according to the selection.
According to the Calculator selection I would remove the Calculator panel (this removes all the views), add a new one and load the layout file for the new calculator to that panel.
The advantage is that you have everything on the same place. The principle above could also be done with the TabHost, always on the main activity.
The advantage with the activities is that your code is more structured, and it is also the Android 'philosophy'.

This is just my opinion.

Best regards.
 
Upvote 0
Top