Reputation: 111
In the calling activity, I have the following code:
Intent intent = new Intent();
intent.setClass(CallingActivity.this, CalledActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(key, new_value);
startActivity(intent);
After the startActivity(intent) is called, the control goes to onResume() of the CalledActivity.
However, in the onResume() of the CalledActivity, getIntent() gives me the old intent and not the new intent as set by the CallingActivity.
How can I get the new intent in onResume() of the CalledActivity??
Upvotes: 7
Views: 4418
Reputation: 754
To expand on dreamtale's answer, just add the following method to your Activity.
@Override
public void onNewIntent (Intent intent) {
setIntent(intent);
}
Upvotes: 3
Reputation: 2913
You should try to override the onNewIntent (Intent intent)
method of Activity, and use setIntent(Intent)
to update the intent.
Upvotes: 12