片段onResume()和backStack问题 [英] Fragment onResume() and backStack issue
问题描述
我坚持局面恢复时,我从另一个片段回来我的片段。
I am stuck with situation for resuming my fragment when I am coming back from another fragment.
情景:
我有一个片段A
。现在我在片段A
打开多个片段用说: A1,A2,A3 ......
使用框架布局。
I have a Fragment A
. Now I am opening multiple fragment with in Fragment A
say : A1, A2, A3 ...
using a frame layout.
现在,我开始一个新的片段说片段B
从A1一/ A2 / A3 ...
Now I am initiating a new Fragment say Fragment B
from one of A1/A2/A3 ...
我进行了片段B
一些动作,现在当我跳出我的片段B
我就不是能够得到onResume()片段A
I am performing some action over Fragment B
and now when I Pop Out my Fragment B
then I am not able to get onResume() of Fragment A
只需要得到onResume(),而我从回来片段B
Just need to get onResume() while I get back from Fragment B
任何帮助,在这个需要!
Any help over this needed!
高AP preciated!
Highly appreciated!
感谢。
推荐答案
启动片段A1,A2,A3与从主片段经理片段A和启动B片段childfragment经理。
Launch fragment A1, A2, A3 with childfragment manager from fragment A and launch fragment B with main fragment manager.
例如:
要执行任何操作的片段,我们有两个片段经理,如果你是你应该使用getChildFragmentManager()getSupportFragmentManager的就地()片段中执行任何片段操作。
For Example : To perform any fragment operation we have two fragment manager, If you are performing any fragment operation within a fragment you should use getChildFragmentManager() inplace of getSupportFragmentManager().
现在在这里,发动片段A1,A2和A3,你应该使用getChildFragmentManager()和当启动B片段,你应该使用getSupportFragmentManager()。所以,当你preSS从B片段回来,你会得到onResume回调A片段。
Now here, to launch fragment A1, A2 and A3 you should use getChildFragmentManager() and When launching fragment B you should use getSupportFragmentManager(). So when you press back from fragment B you will get onResume callback in fragment A.
这篇关于片段onResume()和backStack问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!