Matthew Dolan
1 min readDec 21, 2021

--

There are plenty of other reasons why we should be preferring Fragments over Activities.

Google have talked a little bit about this in the past that one big problem with activities is animations. Device manufacturers have too much freedom to change the animations between activities and they often did overriding anything you try to set yourself. Instead fragments are not part of the system and so don’t suffer the same fate.

In fact, because you are recommended to use fragments always through the jetpack libraries, the implementation is completely platform independent meaning the fragment api can evolve as necessary.

Using nav graph with fragments makes navigation just as easy if not easier than navigating from activity a to b. Plus it’s easier for more complex backward navigation scenarios where perhaps you don’t want certain screens re-appearing. Also, in most cases you can even visualise it in the IDE.

You should fragment.

--

--

Matthew Dolan
Matthew Dolan

Written by Matthew Dolan

Matt Dolan has been eating doughnuts and developing with Android since the dark days of v1.6.

No responses yet