1.对于简单的两个Activity
public class A_activity extends Activity {
public static A_activity _instance = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
.....
_instance = this;
}
}
public class B_activity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
A_activity._instance.finish();
}
}
2.也能够通过ActivityManager
ActivityManager manager = (ActivityManager)getSystemService(ACTIVITY_SERVICE);
manager.restartPackage(packageName);