问题描述
我有两个活动的 ActivityOne 和 ActivityTwo 每一个包含一个片段
I have two activities ActivityOne and ActivityTwo each one contains one Fragment
我做了 startActivityForResult(mIntent,REQUEST_ code)
从第一个活动的片段( ActivityOne )调用的第二个活动( ActivityTwo ),问题是的onActivityResult
的第二个活动一直没有被调用?
i did startActivityForResult(mIntent, Request_code)
from the fragment of the first activity (ActivityOne) for calling the second activity (ActivityTwo), the problem is onActivityResult
of the second activity has not being called?
推荐答案
由于在评论中提及,的onActivityResult
将只在活动称为(如 ActivityOne ),它开始有些其他活动(比如 ActivityTwo )的结果是,使用 startActivityForResult(...)
;
As mentioned in the comment, onActivityResult
will only be called in the activity (e.g. ActivityOne) that started some other activity (e.g. ActivityTwo) for a result, using startActivityForResult(...)
;
您可以在开发者指南
如果,万一,你尝试从 ActivityOne 的东西传递给 ActivityTwo ,结果
你可以使用 putExtra(...)在 ActivityOne &安培;使用 getExtra(...)在 ActivityTwo
If, by any chance, you are trying to pass something from ActivityOne to ActivityTwo,
you can use putExtra(...) in ActivityOne & use getExtra(...) in ActivityTwo.
这篇关于一个的onActivityResult活动片段startActivityForResult以后不叫的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!