2015年9月9日 星期三

來調查一下fragment manager遇到的問題們

Child FragmentManager retained after detaching parent Fragment

Other issues on Google Code

Famous  life cycle issue (commitAllowingStateLoss vs commit)

issue on stack overflow, custom view( 13,983) VS fragment(257,25)

The reason to use fragment . also useful when with custom view
1. Re-use UI ( can be achieved by custom view too)
2. Dynamic bind sub-ui to layout xml ( custom view can bind child view at onInflateChild and onAttachedToWindow)
3. Same XML layout used to design them
4. Both need to implement actions when onBackPressed, onCreateView , fragment transaction and.add to parent view. Same effort

Pros: The reason why you should use custom view with one activity, no fragment
1. View messaging is easy. They have the same activity lifecycle.
2. Get rid of support library and fragment manager
3. less overhead on fragment class
4. Easier lifecycle management
5. Nested view is much easier then nested fragment!s

Cons.
.....can't find one




TBC,,

沒有留言:

張貼留言