Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xamarin.android 如何在取消任何StartActivityForResult时获取意图数据_Xamarin.android - Fatal编程技术网

Xamarin.android 如何在取消任何StartActivityForResult时获取意图数据

Xamarin.android 如何在取消任何StartActivityForResult时获取意图数据,xamarin.android,Xamarin.android,如果手动取消任何StartActivityForResult,则未在ActivityResult中获取数据,是否可以获取数据。如果是,请详细说明 谢谢如果在其他活动中调用SetResult()方法,则可以获取数据。您可以尝试将其放入OnBackPressed()方法中。 例如: public override void OnBackPressed() { Intent intent = new Intent(); inten

如果手动取消任何StartActivityForResult,则未在ActivityResult中获取数据,是否可以获取数据。如果是,请详细说明


谢谢

如果在其他活动中调用
SetResult()
方法,则可以获取数据。您可以尝试将其放入
OnBackPressed()
方法中。
例如:

    public override void OnBackPressed()
    {            
        Intent intent = new Intent();
        intent.PutExtra("Text", "Test");
        SetResult(Result.Canceled, intent);
        base.OnBackPressed();
    }

@ShashikantYadav你能将我的回答标记为答案吗?标记了,但我的声誉不到15,因此发生错误,一旦超过15,我肯定会接受