3 ms·
>At least, that's what happens if activities are used as intended. Activities are indeed the piece of the framework I would be most eager to see removed/revamp
by on_and_off 11y ago
>At least, that's what happens if activities are used as intended.
Activities are indeed the piece of the framework I would be most eager to see removed/revamped.
I have seen many devs (even supposedly experienced ones) use/encourage to use patterns that lead to leaking the Activity context (like retaining everything, especially the UI).
There will always be people writing awful code, but Activities may too hard to grok for many devs (and that's not their only issue by far).
- zserge 11y agoMy first candidate for removal would be fragments. They don't help to componentize apps at all (at least not better than plain old viewgroups), but they can make life much harder with weird hidden bugs. There is brilliant article from Squareup about that - https://corner.squareup.com/2014/10/advocating-against-android-fragments.html https://corner.squareup.com/2014/10/advocating-against-andro... In Anvil I try to follow Square's approach, e.g. keep components as viewgroups and use a custom backstack to manage them as needed (e.g. back/home navigation, multi-pane layouts etc). Then you get just one activity per application and it's a big relief.
- on_and_off 11y agoI am not really convinced. Fragments are not very helpful indeed but all the Android engineers I work with know their lifecycle pretty well and I don't even remember the last time I have seen a prod bug coming from them.