I have 2 activities, A & B for example.
I navigate to Activity B within Activity A using startActivity()
My question is when I’m on Activity B, how can I get access to activity A ?
Thanks,
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.
It really depends on what you want to do, and why you think you need that access. One thing you can do is pass data into an activity using
intent.putExtraand thenstartActivityForResultand listen for results inonActivityResult. Can you give more information on what exactly you want to do?To perform a method when an activity finishes, call the ‘child’ activity like this:
where
CHILD_CODEis a nonnegative integer field. Now, you have to set a result in the ‘child’ activity (the one you started withonActivityResult).now in your ‘parent’ activity, implement the
onActivityResultmethod like this: