I have 3 tabs in my TabHost like you can see
TabHost th = (TabHost) findViewById(R.id.tabhost);
th.setup();
TabSpec specs = th.newTabSpec("Comunidade");
specs.setContent(R.id.tab1);
specs.setIndicator("Comunidade");
th.addTab(specs);
specs = th.newTabSpec("Notícias");
specs.setContent(R.id.tab2);
specs.setIndicator("Notícias");
th.addTab(specs);
specs = th.newTabSpec("Web");
specs.setContent(R.id.tab3);
specs.setIndicator("Web");
th.addTab(specs);
When the application starts the initial tab is “Comunidade” with a listView, so what i want is when i click on a item’s list the View goes to the tab “Web” .
Here is the method :
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> av, View v, int pos, long id) {
ourweb.loadUrl(listadesites.get(pos).getEndereço());
//CODE THAT I NEED
}
});
Thanks in advance.
Use TabHost.setCurrentTab, like this: