10/28/2019, 8:36 AM
Hi everyone! I've stumbled upon this old blog post "Advocating Against Android Fragments" from 2014 which argues that dealing with Fragments is a nightmare and I am better off with custom views for everything. Is this still true in 2019? Did Google do anything to fix this?


10/28/2019, 9:07 AM
I would argue that Fragments are OK in most use cases. I would also say I’ve never experienced said nightmares in my roughly 10 years of doing android work.
👍 2
☝️ 1

Michael Bernier

10/28/2019, 1:47 PM
If you plan on using Navigation Component, then fragment are the way to go, honestly custom views are not better to manage than fragments, and now with androidx, most fragments issues from the past have been fixed

Diogo Ribeiro

10/28/2019, 4:46 PM
I would say...depends. The 2014 problems is valid but we have now more tools to help us out on the final decision. I would create a fragment

Ryan Mentley

10/28/2019, 11:56 PM
Fragments today are much improved from their 2014 state, and there are a number of things that specifically address some of the issues from that blog post


10/29/2019, 12:23 AM
2014 Android development ecosystem was in a different place. Things have improved since than. Fragments are the way to go for there usecase


10/29/2019, 3:00 AM
I remember in 2014 when I read that article I did a big print of the Lifecycle Diagram. Every time I switched companies the first thing I did after being assigned an office was to print this Diagram and nail it in front of me. I love it. I agree with most people here that Fragments have improve and moving them out off the Framework also helps. But I still wonder where is the complexity to swap 2 Views in a Container Layout. Something that could be done with 2 lines of code in a ViewGroup calling removeChild/addChild methods was extremely over-architected with the Fragment API.
👍 1


10/29/2019, 6:05 AM
some of the arguments are still true today (things like transaction exceptions, extra complicated lifecycles). I run into this tech talk

about fragments from Android Dev Summit ’19, which might be interesting to take a look tl;dr Android team is still working on improving it