在项目的页面跳转中,Activity启动顺序为:A--->B---->C------>A
其中A启动模式设置为android:launchMode="singleTask" ,
当C跳转到A时,A将不再执行onCreate方法,而是直接执行onResume;
C通过intent传递参数给A,通过以下方式将无法获取。
@Override
protected void onResume() {
super.onResume();
Bundle bundle = getIntent().getExtras();
if (null != bundle) {
trande_Amount = bundle.getString("Amount");
}
}
解决方法:
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
// must store the new intent unless getIntent() will return the old one
setIntent(intent);
}