AndroidSupportComponents
AndroidSupportComponents copied to clipboard
Activity restart when open startForResultActivity fragment and then setResult
Xamarin.Android Version : 9.0.0.20
Operating System & Version: Mac OSX 10.13.6
Support Libraries Version : 28.0.1
Describe your Issue:
application restart when call setResult
Steps to Reproduce (with link to sample solution if possible):
1-call startActivityForResult from fragment 2-call setResult from the activity opened 3-finish the activity.
The target activity style is
<style name="ActivityDialog" parent="Theme.AppCompat.Light.Dialog.Alert"> <item name="android:windowFrame">@null</item> <item name="android:windowIsFloating">true</item> <item name="android:windowIsTranslucent">true</item> <item name="windowNoTitle">true</item> <item name="android:background">@android:color/transparent</item> <item name="android:windowBackground">@android:color/transparent</item> </style>
Behaviour app restart the whole activity that contain the fragment which call startActivityForResult
Include any relevant Exception Stack traces, build logs, adb logs:
I/MonoDroid: UNHANDLED EXCEPTION: I/MonoDroid: System.NullReferenceException: Object reference not set to an instance of an object I/MonoDroid OnActivityResult (System.Int32 requestCode, System.Int32 resultCode, Android.Content.Intent data) [0x0003f] in <664fb62f58eb444380e61a544ac0fb8f>:0 01-23 16:47:25.779 962-962/MonoDroid: at Android.Support.V4.App.Fragment.n_IILandroid_content_Intent_ (System.IntPtr jnienv, System.IntPtr native__this, System.Int32 requestCode, System.Int32 resultCode, System.IntPtr native_data) [0x00010] in <96541ba8a6104b52aadf4218488f978c>:0 01-23 16:47:25.779 962-962I/MonoDroid: at (wrapper dynamic-method) System.Object.33(intptr,intptr,int,int,intptr)
this issue happened because the fragment which fire start activity for result has 2 static int constant this two constant I use as request code has the same value I don't why this happens or what is the relation between request code and activity recreation but when I change the values of request code the problem solved
Can you provide minimal sample, so I can test it?
Thanks