Xamarin.Android OnActivityResult not being called inside a Fragment

前端 未结 4 405
梦毁少年i
梦毁少年i 2021-01-14 04:46

It appears as if OnActivityResult does not get called after accepting the picture taken from the camera.

Am I calling StartActivityForResult() wrong?, or is

4条回答
  •  被撕碎了的回忆
    2021-01-14 05:19

    For the people that use Android.Support.V4.App Fragment. You can override the OnActivityResult method in your Fragment but it will never be called if you use this in combination with a FragmentActivity! It will be the OnActivityResult of the FragmentActivity that will be called. This can be implemented like following:

    protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
    {
        base.OnActivityResult(requestCode, resultCode, data);
    }
    

提交回复
热议问题