在我的应用程序中,我使用tab小部件来显示不同的活动。
如何存储最后选择的标签?
TabHost tabHost = getTabHost();
// Tab for Foto
TabSpec foto = tabHost.newTabSpec(" Foto ");
foto.setIndicator(" Foto ");
Intent fotoIntent = new Intent(this, Foto.class);
foto.setContent(fotoIntent);
// Tab for Musica
TabSpec musica = tabHost.newTabSpec(" Musica ");
// setting Title and Icon for the Tab
musica.setIndicator(" Musica ");
Intent musicaIntent = new Intent(this, Musica.class);
musica.setContent(musicaIntent);
// Tab for Internet
TabSpec internet = tabHost.newTabSpec(" Internet ");
internet.setIndicator(" Internet ");
Intent internetIntent = new Intent(this, Internet.class);
internet.setContent(internetIntent);
// Adding all TabSpec to TabHost
tabHost.addTab(foto); // Adding foto tab
tabHost.addTab(musica); // Adding musica tab
tabHost.addTab(internet); // Adding Internet tab
}