问题描述
当我在Samsung上调用startActivityForResult(new Intent(getActivity(), VkAuth.class), VK_ID);
时(在HTC和Nexus上一切正常),在创建VkAuth活动之前,将调用具有requestCode == VK_ID和结果代码0(已取消)的onActivityResult
.
父活动具有android:launchMode="singleInstance"
. startActivityForResult
是从附加到父Activity的Fragment调用的.日志
When I call startActivityForResult(new Intent(getActivity(), VkAuth.class), VK_ID);
on Samsung (on HTC and Nexus everything works fine), onActivityResult
with requestCode == VK_ID and result code 0 (Cancelled) is called before the VkAuth Activity is created.
The parent Activity has android:launchMode="singleInstance"
. startActivityForResult
is called from a Fragment attached to the parent Activity.Log
E/AuthenticationFragment: vkLogIn
E/AuthenticationFragment: startActivityForResult 9101
E/AuthenticationFragment: onPause
E/MainActivity: onPause
E/MainActivity: onActivityResult before super: request - 271245, result - 0
E/AuthenticationFragment: request - 9101, result - 0
E/MainActivity: onActivityResult after super: request - 271245, result - 0
E/AuthenticationFragment: onPause
E/MainActivity: onPause
E/VkAuth: onCreate
E/VkAuth: onResume
推荐答案
在我删除了android:launchMode ="singleInstance"之后,此错误行为停止了
after i removed android:launchMode="singleInstance", this misbehaivior stoped
这篇关于startActivityForResult(...)立即返回0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!