The hosting activity overrides onActivityResult()
, but it did not make a call to super.onActivityResult()
for unhandled result codes.
(托管活动会覆盖onActivityResult()
,但不会为未处理的结果代码调用super.onActivityResult()
。)
Apparently, even though the fragment is the one making the startActivityForResult()
call, the activity gets the first shot at handling the result. (显然,即使该片段是调用startActivityForResult()
的片段,该活动也会在处理结果时获得第一炮。)
This makes sense when you consider the modularity of fragments. (当您考虑片段的模块化时,这很有意义。)
Once I implemented super.onActivityResult()
for all unhandled results, the fragment got a shot at handling the result. (一旦为所有未处理的结果实现了super.onActivityResult()
,该片段就可以处理结果了。)
And also from @siqing answer:
(并且也来自@siqing答案:)
To get the result in your fragment make sure you call startActivityForResult(intent,111);
(要获得片段中的结果,请确保调用startActivityForResult(intent,111);
)
instead of getActivity().startActivityForResult(intent,111);
(而不是getActivity().startActivityForResult(intent,111);
)
inside your fragment. (在您的片段中。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…