I want to pass a new, but different, Intent to an Activity. How do you differentiate between the new Intent and previous Intents? What kind of code goes into onNewIntent()? An example will be very helpful.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The new intent comes as part of
onNewIntent(Intent). The originalIntentis still available viagetIntent().You put whatever code you need to into
onNewIntentin order to update the UI with the new parameters; probably similar to what you’re doing inonCreate.Also, you probably want to call
setIntent(intent)inonNewIntentto make sure future calls togetIntent()within the Activity lifecycle get the most recentIntentdata.