Answer the question
In order to leave comments, you need to log in
Passing an argument to an activity?
I know that when calling a new activity, you can pass data through the intent, but what if I close the finish() activity and the previous activity opens. Is there any way to transfer data here?
Answer the question
In order to leave comments, you need to log in
There is a special mechanism for this. To do this, your activity that wants to send data back needs to be started via startActivityForResult. It must set setResult before executing finish. In the activity that lies in the backstack (where the result should come), you need to override onActivityResult.
Documentation .
you can override onBackPressed and start a new activity with the necessary data
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question