Пытаюсь установить активити в качестве вкладок TabHost и вижу эксепшн android.content.res.Resources$NotFoundException: Resource ID #0x0
Android 4.2.2, отлаживаю на телефоне.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tabs);
TabHost tabHost = new TabHost(this);
tabHost.setId(android.R.id.tabhost);
TabWidget widget = new TabWidget(this);
widget.setId(android.R.id.tabs);
FrameLayout content = new FrameLayout(this);
content.setId(android.R.id.tabcontent);
LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
layout.addView(widget);
layout.addView(content);
tabHost.addView(layout);
setContentView(tabHost);
TabHost.TabSpec tab1 = tabHost.newTabSpec("tab1");
tab1.setIndicator("Tasks");
tab1.setContent(new Intent(this, TasksActivity.class));
try {
tabHost.addTab(tab1);
} catch (Exception e) {
e.toString();
}
TabHost.TabSpec tab2 = tabHost.newTabSpec("tab2");
tab2.setIndicator("Employee");
tab2.setContent(new Intent(this, EmployeeActivity.class));
tabHost.addTab(tab2);
tabHost.setCurrentTab(0);
}
Как ее победить?