When TabHost implemented by ActivityGroup is switched from tab1 to tab2, the activity in tab1 is reloaded.
Public class MainUIActivity extends ActivityGroup {private Context context = this; private TabHost mTabhost; private String TAB1 = "Homepage"; private String TAB2 = "favorites"; private String TAB3 = "3 "; private String TAB4 = "4"; private String TAB5 = "more"; // define an array to store the button image private int mImageViewArray [] = {R. drawable. tab_home_btn, R. drawable. tab_message_btn, R. drawable. tab_selfinfo_btn, R. drawable. tab_square_btn, R. drawable. tab_more_btn}; // The text of the Tab is private String mTextviewArray [] = {TAB1, TAB2, TAB3, TAB4, TAB5}; @ Overrideprotected void onCreate (Bundle savedInstanceState) {// TODO Auto-generated method stubsuper. onCreate (savedInstanceState); setContentView (R. layout. tab_main); mTabhost = (TabHost) findViewById (R. id. tabhost1); mTabhost. setup (); mTabhost. setup (this. getLocalActivityManager (); Intent i1 = new Intent (this, MainActivity. class); Intent I _collect = new Intent (this, CollectActivity. class); // Intent i1 = new Intent (this, MainActivity. class); // Intent i1 = new Intent (this, MainActivity. class); // Intent i1 = new Intent (this, MainActivity. class); mTabhost. addTab (mTabhost. newTabSpec (TAB1 ). setIndicator (getTabItemView (0 )). setContent (R. id. zhuye ). setContent (i1); // Note: newTabSpec (TAB2) is used here. Each tab must be written differently so that the original status mTabhost can be saved. addTab (mTabhost. newTabSpec (TAB2 ). setIndicator (getTabItemView (1 )). setContent (R. id. zhuye2 ). setContent (I _collect); mTabhost. addTab (mTabhost. newTabSpec (TAB1 ). setIndicator (getTabItemView (2 )). setContent (R. id. zhuye3 ). setContent (i1); mTabhost. addTab (mTabhost. newTabSpec (TAB1 ). setIndicator (getTabItemView (3 )). setContent (R. id. zhuye4 ). setContent (i1); mTabhost. addTab (mTabhost. newTabSpec (TAB1 ). setIndicator (getTabItemView (4 )). setContent (R. id. zhuye5 ). setContent (i1);}/*** set the icon and text for the Tab button */private View getTabItemView (int index) {View view = LayoutInflater. from (context ). inflate (R. layout. tab_item, null); ImageView imageView = (ImageView) view. findViewById (R. id. tab_icon); imageView. setImageResource (mImageViewArray [index]); TextView textView = (TextView) view. findViewById (R. id. tab_name); textView. setText (mTextviewArray [index]); return view;} public static Intent createIntent (Context context) {Intent I = new Intent (context, MainActivity. class); I. addFlags (Intent. FLAG_ACTIVITY_CLEAR_TOP); return I ;}}The solution has been written in the code above, that is, to set different tags for each tab