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);
//关闭旧的activity,以重启
if(A.actNativityA!=null) {
A.finish();
}
Intent intent = new Intent(); //生成Intent对象
//指定要启动的Activity
intent.setClass(MainActivity.this, A.class);
startActivity(intent); //
。。。
}
}