[Android] PLAYING WITH FRAGMENT
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

[Android] PLAYING WITH FRAGMENT

  • 1,118 views
Uploaded on

PT.BUZOO INDONESIA is No1 Japanese offshore development company in Indonesia. ...

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/

More in: Technology , Business
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,118
On Slideshare
1,117
From Embeds
1
Number of Embeds
1

Actions

Shares
Downloads
17
Comments
0
Likes
1

Embeds 1

https://www.chatwork.com 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. • FragmentManager • FragmentTransaction
  • 2. Fragment.getActivity() • FragmentManager.findFragmentById(int id) • FragmentManager.findFragmentByTag(String tag)
  • 3. onItemClick
  • 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. onItemClick
  • 6. setArguments
  • 7. getArguments
  • 8. • add • remove • replace • hide • show
  • 9. FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.add(R.id.main, detailFragment) .addToBackStack(null) .commit();
  • 10. Fragment inside another fragment FragmentTransaction transaction = detailFragment.getChildFragmentManager().beginTransaction(); transaction.add(R.id.detail, nestedFragment, "nested") .addToBackStack(null) .commit();
  • 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. A A B getSupportFragmentManager(). popBackStack(“fragmentA”, 0); getSupportFragmentManager(). popBackStackImmediate(“fragmentA”, 0); A BC