I need to create all the UI programmatically "on demand", this means I can't use any XML. This is the pseudo code of what I do:
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);
so when TabContentFactory is called I return the view which is the content view of the current activity. Basically what I do is taking current view and wrapping it in the tabhost.
It half works, when I do this I'm able to see the tabbar, but only black view below it, if I click on other tab and then click back then I can see the view, everything works as intended.
Now why I think it's related 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 is working perfectly. Any help appreciated, thanks!