onActivityResult not working on fragments

喜夏-厌秋 提交于 2019-12-11 08:47:02

问题


onActivityResult not working with fragments..how to call onActivityResult in a class which extends fragment not fragment activity.Is there any other method similar to onActivityResult in fragments?


回答1:


1. Make sure your code like this:

startActivityForResult(intent,req);

and not this:

getActivity().startActivityForResult(intent,req);

2. Make sure implement your Fragment's onActivityResult:

super.onActivityResult(requestCode, resultCode, data);


来源:https://stackoverflow.com/questions/19005193/onactivityresult-not-working-on-fragments

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!