Closed allsoft777 closed 9 years ago
Do you have concrete source code or a demo project a can have a look at to reproduce this issue ?
Hi~ Hannes.
I've attached the demo project.
If you have any time, please take a look at the project.
The issue is occuring on below path.
MonthlyReportFragmentItem.java
@Override
public LceViewState<List
Thanks!
ViewStateTest.zip https://drive.google.com/file/d/0BwbnfAfPxdhkUy1hYzJfRTZJdjg/view?usp=drive_web
2015-08-02 22:34 GMT+09:00 Hannes Dorfmann notifications@github.com:
Do you have a concrete source code or a demo project a can have a look at?
— Reply to this email directly or view it on GitHub https://github.com/sockeqwe/mosby/issues/74#issuecomment-127024441.
thanks, I will have a look at it tomorrow
I'm not 100% sure, but I don't think that your problem is Mosby related (I may be wrong).
I have added a demo to the official mosby samples to demonstrate that nested fragments are working properly.
Something strange happens in your app with the saved instance state bundle.
The savedInstanceState Bundle
of all of your fragments are always null after screen orientation changes which has two causes:
I think 2.
is the case.
Your code is a little bit confusing at this point but I guess the problem is that you are replacing the old fragment with a new / or the same fragment retrieved from FragmentManager.findFragmentByTag()
previously.
Have a look at MainActivity.onNavigationDrawerItemSelected()
:
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(R.id.container, fragment, tag);
ft.addToBackStack(null);
ft.commitAllowingStateLoss();
Doesn't it replace the MonthlyReportFragment
?
Yes, you are right. The root cause was on NavigationDrawerFragment class. Whenever rotating the device, switching the main fragment is called always. I've fixed by modifying the framgment structure. Thanks.
On fragment, the createViewState method is always called on nested fragments. So, it doesn't restore the view state and data when rotating the device. Could you check it out? As i see it, it could be called once when created the fragment.