i’m getting a weird null pointer exception in the last line of this code:
tab.addTab(newSpec);
this is the code:
private TabHost tab;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_friends);
tab = (TabHost) findViewById(R.id.activity_friends_tab);
addTab("Chat", ChatTab.class);
}
private void addTab(String title, Class<?> cls)
{
TabSpec newSpec = tab.newTabSpec(title);
newSpec.setIndicator(title);
Intent newIntent = new Intent(this, cls);
newSpec.setContent(newIntent);
tab.addTab(newSpec);
}
can’t understand why..
found my error:
i should have added the local activity manager and run tab.setup: