G
G
goodTimes2017-03-17 13:37:11
JavaScript
goodTimes, 2017-03-17 13:37:11

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

2 answer(s)
D
Denis Zagaevsky, 2017-03-17
@goodtimes922

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 .

D
davidnum95, 2017-03-17
@davidnum95

you can override onBackPressed and start a new activity with the necessary data

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question