In Android, when you jump between activity, you can use intent (Intent) to pass the corresponding data.
The new activity is not in the same thread as the main activity, and when the new activity is closed, the main activity is triggered Onactivityresult event.
Startactivityforresult (Intent Intent, int requestcode): The main activity jumps with the request code a new activity interface.
Onactivityresult (int requestcode, int resultcode, Intent data)
-Requestcode: This parameter can be used to determine which interface is coming back from.
-ResultCode, data: Sent back by the closed interface
when we close the new activity, it triggers the Onactivityresult method of the main acvitity, then because before the main activity sent a request code, this time can be based on the request code to determine from which interface back.
* setresult (int resultcode): Sets the data passed to the previous interface
* setresult (int resultcode, Intent data): Set up a pass to the previous interface
You can also set some result code information when you return to the main activity from the new activity.
The request code and the result code in intent