• FragmentManager

• FragmentTransaction
Fragment.getActivity()
• FragmentManager.findFragmentById(int id)
• FragmentManager.findFragmentByTag(String tag)
onItemClick
OnItemClickListener callback;
public void onAttach(Activity activity) {
super.onAttach(activity);
try{
callback = (OnItemC...
onItemClick
setArguments
getArguments
• add
• remove
• replace
• hide
• show
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();

transaction.add(R.id.main, detailFragme...
Fragment inside another fragment
FragmentTransaction transaction = detailFragment.getChildFragmentManager().beginTransacti...
A

A
B

transaction.add(R.id.main, fragmentA).addToBackStack(“fragmentA”).commit();
transaction.add(R.id.main, fragmentB);...
A

A
B

getSupportFragmentManager(). popBackStack(“fragmentA”, 0);
getSupportFragmentManager(). popBackStackImmediate(“fra...
[Android] PLAYING WITH FRAGMENT
[Android] PLAYING WITH FRAGMENT
[Android] PLAYING WITH FRAGMENT
[Android] PLAYING WITH FRAGMENT
[Android] PLAYING WITH FRAGMENT
[Android] PLAYING WITH FRAGMENT
Upcoming SlideShare
Loading in...5
×

[Android] PLAYING WITH FRAGMENT

830

Published on

PT.BUZOO INDONESIA is No1 Japanese offshore development company in Indonesia.
We are professional of web solution and smartphone apps. We can support Japanese, English and Indonesia.
We are hiring now at http://buzoo.co.id/

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
830
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
36
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

[Android] PLAYING WITH FRAGMENT

  1. 1. • FragmentManager • FragmentTransaction
  2. 2. Fragment.getActivity() • FragmentManager.findFragmentById(int id) • FragmentManager.findFragmentByTag(String tag)
  3. 3. onItemClick
  4. 4. OnItemClickListener callback; public void onAttach(Activity activity) { super.onAttach(activity); try{ callback = (OnItemClickListener) activity; }catch(ClassCastException e){ throw new ClassCastException(activity.toString() + " must implements OnItemClickListener"); } }
  5. 5. onItemClick
  6. 6. setArguments
  7. 7. getArguments
  8. 8. • add • remove • replace • hide • show
  9. 9. FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.add(R.id.main, detailFragment) .addToBackStack(null) .commit();
  10. 10. Fragment inside another fragment FragmentTransaction transaction = detailFragment.getChildFragmentManager().beginTransaction(); transaction.add(R.id.detail, nestedFragment, "nested") .addToBackStack(null) .commit();
  11. 11. A A B transaction.add(R.id.main, fragmentA).addToBackStack(“fragmentA”).commit(); transaction.add(R.id.main, fragmentB); transaction.add(R.id.main, fragmentC); A BC
  12. 12. A A B getSupportFragmentManager(). popBackStack(“fragmentA”, 0); getSupportFragmentManager(). popBackStackImmediate(“fragmentA”, 0); A BC
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×