3 つのアクティビティを含む tabHost を作成したので、タブをクリックするとアクティビティが変更されます。
これは最初のアクティビティのコードです:
public class estadisticas extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.estadisticas);
// TABS
Intent intent1 = new Intent(estadisticas.this, clasificacion.class);
Intent intent2 = new Intent(estadisticas.this, novedades.class);
Resources res = getResources();
TabHost tabHost = (TabHost) findViewById(R.id.mytabhost);
tabHost.setup();
//tab 1
TabSpec tab1 = tabHost.newTabSpec("estadisticas");
tab1.setIndicator(getString(R.string.statistics),res.getDrawable(R.drawable.estadisticastabs));
tab1.setContent(R.id.tab1);
tabHost.addTab(tab1);
//tab 2
TabSpec tab2 = tabHost.newTabSpec("clasificacion");
tab2.setIndicator(getString(R.string.scores),res.getDrawable(R.drawable.estadisticastabs));
tab2.setContent(intent1);
tabHost.addTab(tab2);
//tab 3
TabSpec tab3 = tabHost.newTabSpec("novedades");
tab3.setIndicator(getString(R.string.whatsnew),res.getDrawable(R.drawable.estadisticastabs));
tab3.setContent(intent2);
tabHost.addTab(tab3);
// END TABS
そして、両方(またはタブ2またはタブ3)をクリックするとシャットダウンします。
どこが間違っていますか?ありがとう。