使用ActivityGroup来切换Activity和Layout

转自 http://www.cnblogs.com/over140/archive/2010/09/07/1820876.html


核心代码如下,ActivityGroup继承自Activity

public class ActivityG extends ActivityGroup {
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //
        
        Intent i = new Intent(this,ActivityB.class);
        //this.startActivity(i);
        ActivityGroup ag = this;
        LocalActivityManager alm = ag.getLocalActivityManager();
        Window win = alm.startActivity("module1", i);
        View view = win.getDecorView();
        
        setContentView(view);
    }
}

你可能感兴趣的:(Module,layout,Class,2010)