在ExerciceActivity
我展示ExerciceFragment
:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
addFragment(ExerciceFragment.newInstance(exerciceId), ExerciceFragment.TAG);
}
从ExerciceFragment
开始,我使用EventBus启动另一个片段
库。该事件正在ExerciceActivity
中找到:
public void onEvent(ShowExercicePhotosGalleryEvent event) {
addFragment(ExercicePhotosGalleryFragment.newInstance(event), ExercicePhotosGalleryFragment.TAG);
}
要从ExerciceFragment
backstack弹出Fragment
,我就这样做了:
private void exit() {
FragmentManager fm = getFragmentManager();
if (fm.getBackStackEntryCount() > 0) {
fm.popBackStack();
} else {
super.onBackPressed();
}
}
这里的一切都很完美。在ShowExercicePhotosGalleryEvent
我修改了toolbarAppearance(alpha=0)
。当我回到ExerciceFragment
时,我想恢复我的初始工具栏。那么,当我回到ExerciceFragment
时,会调用哪种方法?
谢谢你们!