Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fragment & FragmentStack management #93

Closed
lduparc opened this issue Jul 17, 2015 · 3 comments
Closed

Fragment & FragmentStack management #93

lduparc opened this issue Jul 17, 2015 · 3 comments
Labels

Comments

@lduparc
Copy link

lduparc commented Jul 17, 2015

Consider an Activity with a NavigationDrawer and a list of fragments. Using the drawer I can navigate to each fragment but in order to build a responsive and powerful application I have to :

  • Manage transitions between fragments
  • Do not instantiate every time a fragment but use an existing one if possible
  • Manage fragment state and its data
  • Working with AppCompatActivity and OptionsMenu (Backpressed & Toolbar back button/Title)

Perform an Android application working with fragments implies to manage a lot of things.
Would be great to have a guide for this.

I'm not asking for a sample, but for a documentation who explain how to implement this as best as possible.

Improve the NavigationDrawer part with these cases could be great.

@rogerhu
Copy link
Member

rogerhu commented Jul 18, 2015

  1. Navigating between fragments - http://guides.codepath.com/android/Creating-and-Using-Fragments#navigating-between-fragments

  2. See http://guides.codepath.com/android/Creating-and-Using-Fragments#fragment-hiding-vs-replace --> if you keep all the fragments in memory and just simply want to hide/show, you can do it this way.

(It's dangerous to keep references to fragments since they have their own lifecycle (i.e. if you hold onto a reference and replace a fragment with another, that old reference may cause memory leaks -- so you have to choose between show vs hide...

  1. Fragment states & data --> I am starting to be of the opinion they are better managed as singleton instances via Dagger than trying to use Icepick to store them (does anyone else have opinions?)

  2. See http://guides.codepath.com/android/Creating-and-Using-Fragments#actionbar-menu-items-and-fragments

@rogerhu
Copy link
Member

rogerhu commented Jul 18, 2015

FYI -- about #2, you can also do show/hide as discussed in http://guides.codepath.com/android/Creating-and-Using-Fragments#fragment-hiding-vs-replace.

In general I think this guide covers a lot about the ins/outs of fragments.

@aman-jham
Copy link

https://github.com/codepath/android_guides/wiki/Google-Play-Style-Tabs-using-TabLayout
Can any one tell me how to customize the tabindicator i need image instead of line.Is it possible to customize

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants