Reputation: 326
We have been learning how to open new Activities, in class, but so far the second activity runs its logic from the OnCreate()
class.
I am wanting to return directly to activity one, from activity two, but run a function in its java when I do so.
All I've been able to find on the matter is how to effectively write my own "back" button.
I am needing to pass a string, as well as an int, that was originally sent from activity one to activity two. I need to compare the received int with the sent int to confirm it is coming from the same source.
My biggest problem is that we were taught to use OnCreate()
. This will not work on returning to an Activity, as OnCreate only runs when the instance is first created. If I am creating the instance as I move back, my other function will not work.
Upvotes: 0
Views: 1295
Reputation: 254
You can just use an startActivityForResult method.
Here is a topic of that: How to manage `startActivityForResult` on Android?
Hope it helps :)
Upvotes: 1