Giải pháp: 'hoạt động đổ vỏ adb' không hoạt động với TabActivity. Khi mỗi mục tab được chọn, hoạt động tương ứng sẽ được khởi chạy. Nhưng khi sử dụng 'adb shell dumpsys hoạt động' Nó luôn trả về hoạt động 'chính':
public class main extends TabActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
Log.e("xyz", "start main...............");
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Resources res = getResources(); // Resource object to get Drawables
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab
// Create an Intent to launch an Activity for the tab (to be reused)
intent = new Intent().setClass(this, widgets.class);
spec = tabHost.newTabSpec("Widgets").setIndicator("Widgets", res.getDrawable(R.drawable.tab1)).setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, layouts.class);
spec = tabHost.newTabSpec("Layouts").setIndicator("Layouts",res.getDrawable(R.drawable.tab2)).setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, composite1.class);
spec = tabHost.newTabSpec("Composite").setIndicator("Composite",res.getDrawable(R.drawable.tab3)).setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, imageMedia.class);
spec = tabHost.newTabSpec("Image_Media").setIndicator("Image&Media",res.getDrawable(R.drawable.tab4)).setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, timeDate.class);
spec = tabHost.newTabSpec("Time_Date").setIndicator("Time&Date",res.getDrawable(R.drawable.tab5)).setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, transitions.class);
spec = tabHost.newTabSpec("Transitions").setIndicator("Transitions",res.getDrawable(R.drawable.tab6)).setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, advanced.class);
spec = tabHost.newTabSpec("Advanced").setIndicator("Advanced",res.getDrawable(R.drawable.tab7)).setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, others.class);
spec = tabHost.newTabSpec("Others").setIndicator("Others",res.getDrawable(R.drawable.tab8)).setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, Dynamic.class);
spec = tabHost.newTabSpec("Dynamic").setIndicator("Dynamic",res.getDrawable(R.drawable.tab2)).setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(0);
}
}