Hacker News new | ask | show | jobs
by fredgrott 4205 days ago
I would ask how they dealt with nested fragments pain
2 comments

Don't nest fragments. Just don't. Fragments are half baked. Nested fragments are half (quarter?) baked.

In most cased the inner fragment could be made into a custom View, and those work a lot better. Most new Android developer do not make enough custom views. They are the fundamental unit of UI re-use. It's relatively simple to extends FrameLayout or RelativeLayout, encapsulate a view normal views, layer your logic on top, and you have a nice usable component.

As an experienced Android dev, I cannot agree more. I have never had a particularly fun experience with fragments, although they definitely have their place. Custom views though... I love them more every day.
We had high hopes for nested fragments, especially to support UI interactions like those in the Gmail app: http://stackoverflow.com/q/12253965/2561578

However, in our v1 the only fragments that share an activity are our main feed & story view. All other's have their own activity. It made data flow a lot easier, our manifest file a lot cleaner when filtering for intents, etc.

Interested to hear any tips if you have them!