Explanation onAttach() of Fragment class in Android

14,916 views

Published on

Explanation onAttach() of Fragment class in Android

Published in: Technology, Education
2 Comments
4 Likes
Statistics
Notes
No Downloads
Views
Total views
14,916
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
27
Comments
2
Likes
4
Embeds 0
No embeds

No notes for slide

Explanation onAttach() of Fragment class in Android

  1. 1. FRAGMENT FragmentActivity Fragment (Explain onAttach() in Fragment) Author: hungtdo 14/12/2013
  2. 2. Fragment • Supported in android-support-v4.jar • Fragment native same use v4 lib
  3. 3. Fragment Flow onAttach() onCreate() onCreateView() onActivityCreated()
  4. 4. Explain onAttach() in Fragment
  5. 5. Explain onAttach() in Fragment In FragmentActivity (in native code) -> With (mFragments : FragmentManagerImpl instance) + Native attachActivity in FragmentManagerImpl class: -> This method only set values to global variable of local class to used in methods
  6. 6. Explain onAttach() in Fragment  Then, in this "FragmentManagerImpl" class, method Fragment.onAttach(this.mActivity); is called with "this.mActivity- fragmentActivity" is parameter.  Same time this.mActivity.onAttachFragment(f); is called to notify for FragmentActivity fragment is attached
  7. 7. Author: HUNGTDO (a.k.a yuchi_1k91) Tools: Java decompiler Lib: android-support-v4.jar

×