A--> startactivityforresult--> B-->setresult does not perform the Finish method A is the Setresult method executed in B or B after the finish Onactivityresult method?
a--> startactivityforresult--> b-->setresult--> Finish If there is activity a in the middle of a and B in the stack will not be executed after (B Setresult and finish) Onactivityresult method instead of executing the parameters immediately after a startactivityforresult resultcode to Result_cancel This situation may occur when a and B are not on the same stack (for example, the startup mode for B is Tan (details))
The correct invocation order is as follows
a--> startactivityforresult--> b-->setresult--> finish--> a-->onactivityresult-->onrestart--& Gt;onstart-->onresume
The Onactivityresult method annotation for the cause activity is as follows
/**
* Called when a activity you launched exits, giving you the Requestcode
* You started it with, the ResultCode it returned, and any additional
* Data from it. The <var>resultCode</var> would be
* {@link #RESULT_CANCELED} if the activity explicitly returned that,
* didn ' t return any result, or crashed during its operation.
*
* <p>you'll receive this call immediately before Onresume () when your
* Activity is re-starting.
*
* @param requestcode The integer request code originally supplied to
* Startactivityforresult (), allowing you to identify
* result came from.
* @param resultcode The integer result code returned by the child activity
* Through its setresult ().
* @param data an Intent, which can return result data to the caller
* (various data can be attached to Intent "extras").
*
* @see #startActivityForResult
* @see #createPendingResult
* @see #setResult (int)
*/
Execute the Onresume method before executing Onactivityresult test the OnStart method after Onactivityreult Onrestart should be the same
Conclusion Onactivityresult is performed in the execution life cycle method first.
Callback sequence after executing Setresult