我使用Flags Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP
启动旧的Activity,但我无法使用putExtra
向此活动发送字符串:
Intent intent = new Intent(INTENT_ActivityA);
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra("DATA", "OK");
startActivity(intent);
<{1}} onResume
中的
如何将数据发送到正在运行的Activity?
答案 0 :(得分:8)
如果你覆盖onNewIntent,我认为你应该在其中包含你的数据。试试以下
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
intent.getStringExtra("DATA");
}
希望它有所帮助!