解决方案:“ adb shell dumpsys活动”不适用于TabActivity。选择每个选项卡项目后,将启动相应的活动。但是当使用'adb shell dumpsys activity'时,它总是返回'main'活动:
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);
}
}