1.加载子Activity到ActivityGroup中
<span style="white-space:pre"> </span>bodyView.removeAllViews();
String id = intent.getComponent().getShortClassName();
View view = getLocalActivityManager().startActivity(id, intent).getDecorView();
view.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));//此代码句将子页面铺满group中的view
view.dispatchWindowFocusChanged(true);
bodyView.addView(view);
2.将ActivityGroup中的Activity删除
<span style="white-space:pre"> </span>getLocalActivityManager().destroyActivity(id, true);
//锟斤拷未锟斤拷锟斤拷锟斤拷锟斤拷锟絘ndroid源锟斤拷锟斤拷destroyActivity锟斤拷一锟斤拷bug:
try {
Field f = getLocalActivityManager().getClass().getDeclaredField("mActivities");
f.setAccessible(true);
((Map<?, ?>)f.get(getLocalActivityManager())).remove(id);
} catch(Exception e) {
e.printStackTrace();
}