I am attempting to use a few of the simple android examples for Tab Views. One thing i am attempting to do different than all the examples i’ve seen so far, is to not use a TabActivity. I am trying to use a normal activity, which means i need to retrieve the TabHost object some how, so i can add tabs and etc to it. How can this be done?
If you wanted to retrieve a view, you can simply use findViewById(R.id.blah), but how can you retrieve the TabHost object in a similar manner?
EDIT:
So CommonsWare provided the answer to the question i was asking, but i had not stated my problem it seems. I was using findViewById, and casting it as a TabHost, ala TabHost tab_host = (TabHost)this.findViewById(R.id.mytabhost);, but whenever i used it the application would crash.
The problem is if you are not using TabActivity, TabHost.setup() is never called, so you need to yourself.
This issue is now resolved 🙂
Call
findViewById().A
TabHostis aView. You find it by callingfindViewById().