one: Common jump implementations between activity in Android
1) startactivity (Intent Intent);
2) Startactivityforresult (Intent Intent, int requestcode);
The difference is that (2) data can be returned. Such as:
II: Instructions for use
startActivityForResult(Intent intent, int requestCode)
Start multipleActivitya,B, C, available through requestcode determine the difference;
setResult(resultCode);
functionA, B, Cwhen returned, by resultcode difference;
@Override protected voidOnactivityresult(intRequestcode, intResultCode, IntentData) {< Span class= "PLN" style= "Color:rgb (72,72,76)" > super onactivityresult ( requestcode ResultCode data }
through requestcode and ResultCode determination of data;
Three: precautionsonbackpressed () callSetresult ();
OnDestroy () call setresult ();
< Span style= "font-size:18px" > contrast style= font-size:14px "; Color:windowtext; Font-family:consolas ">onactivityresult style= font-size:14px; Color:windowtext; Font-family:consolas ">activity-b onPause () activity-a Onrestart () Before the function is called.
so setresult () needs to be OnPause () function is called before the onStop () or OnDestroy () function cannot return data.
Four: extension
onStop () and the OnDestroy () do cleanup, release resources, and not pass data.
Android's Startactivityforresult