Júlio César Bindandi :
The question is not about how to use startActivityForResult but about the life cycle relating to the finish () event.
I am developing an app in java, android studio.
I have two activitys, A and B, being A my MainActivity.
When I'm in activity B and I press the back button on android (onBackPressed) ...
finish();
I need to do some things in activity A.
The onCreate method is not executed since the activity was already created ... which method can I use?
Dinorah Tovar :
What you need to do is use onActivityResult(...)
but for that, you need to specify the startActivityForResult value and send the result on the Activity B
Intent().also {
startActivityForResult(pickContactIntent, PICK_CONTACT_REQUEST)
}
For more information: https://developer.android.com/training/basics/intents/result