xamarin / AndroidSupportComponents

Xamarin bindings for Android Support libraries - For AndroidX see https://github.com/xamarin/AndroidX
MIT License
146 stars 56 forks source link

Activity restart when open startForResultActivity fragment and then setResult #148

Open michaelsam94 opened 5 years ago

michaelsam94 commented 5 years ago

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 ``

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)

michaelsam94 commented 5 years ago

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

moljac commented 5 years ago

Can you provide minimal sample, so I can test it?

Thanks