[英]Backward calls and onActivityResult() not calling in Fragment but calls in activity
I have A activity. 我有活动。 This contain 4 Fragments.
这包含4个片段。 I created separated Fragment class in other packages.
我在其他程序包中创建了单独的Fragment类。 so A activity contain 4 Fragments.
因此一个活动包含4个片段。 one of them is B fragment.
其中之一是B片段。 Now B Fragment calls to Activity C by startActivityForResult.
现在,B片段通过startActivityForResult调用ActivityC。 so i writes the method onActivityResult in B Fragment.
所以我在B Fragment中写了onActivityResult方法。 But same method is also in Activity A which is most important and can't be remove.
但是,活动A中也使用了相同的方法,这是最重要的,无法删除。 Now when I came back from C -- > B then onActivityResult is not calling but activity A's onActivityResult calls.
现在,当我从C-> B返回时,onActivityResult不是在调用,而是活动A的onActivityResult在调用。 so how can i call to this method in (B)fragment too.
所以我也该如何在(B)片段中调用此方法。 so i can change the data by calling it.
所以我可以通过调用它来更改数据。
Try to call 尝试致电
super.onActivityResult();
in your Activities onActivityResult() to pass the Callback to your Fragment. 在您的Activity onActivityResult()中将回调传递给您的片段。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.