public class A extends Activity {
public static Activity actNativityA=null; //随时停止或重启 NativityView
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
actNativityA=this;
。。。
}
}
public class B extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
A a = new A(); //关闭旧的activity,以重启
if(a.actNativityA!=null) {
a.finish();
a=null;
}
Intent intent = new Intent(); //生成Intent对象
//指定要启动的Activity
intent.setClass(MainActivity.this, A.class);
startActivity(intent); //
。。。
}
}