Android-Fragment's onActivity strange Bug
1. You will often see the nested Fragment of the Activity, and open another Activity from Fragment,
When the onActivityResult () method of Activity and Fragment is rewritten, it is found that the onActivityResult () method of the Fragment is not executed,
The onActivityResult () method for executing the Activity. The reason is that the method for opening another Activity is incorrect.
In the Activity, activity. startActivityForResult (intent, requestCode );
In Fragment, f. startActivityForResult (intent, requestCode) is also available );
That is to say, the onActivityResult () of the person who opens the message is called ();
2. Recently, we made an image retrieval function in Fragment, that is, enabling the image retrieval function of the system to retrieve the selected image.
But this function is in the Fragment of the main Activity, because we often change the loading mode of the main Activity to SingleInstance,
In Fragment, onActivityResult () is executed when the Activity for image search is enabled, and the system resultCode returns the default cancel constant.
The solution is to restore the loading mode to the default one.