I need to create all the UI programmatically "on demand", which means that I can not use any XML. This is the pseudo code of what I am doing:
View v = new MyView(); activity.setContentView(v); tabHost = new TabHost(); .... tabHost.setup(); TabSpec tabSpec = _tabHost.newTabSpec(page); tabSpec.setIndicator(title); tabSpec.setContent((TabContentFactory) this); activity.setContentView(tabHost);
therefore, when a TabContentFactory is called, I return a view that is a view of the contents of the current activity. Basically what I am doing is the current view and porting it to tabhost. It works halfway, when I do this, I can see the tab, but only the black view below it, if I click on another tab and then click back, then I see the view, everything works as intended.
Now, why do I think this is due to setContentView , because when I do this:
View v = new MyView(); // activity.setContentView(v); // we don't use it as current content view tabHost = new TabHost(); .... tabHost.setup(); TabSpec tabSpec = _tabHost.newTabSpec(page); tabSpec.setIndicator(title); tabSpec.setContent((TabContentFactory) this);
Then everything works fine. Any help appreciated, thanks!
source share