and is it recommended to use both fragments and co...
# compose
f
and is it recommended to use both fragments and composables within the same Android app?
z
I wouldn’t do this unless in a new app you’re using some library that requires fragments. Otherwise it’s just unnecessary complexity
s
Here’s the only one case where I can imagine someone wanting to do that: • You are using androidx navigation • You want type-safe navigation between your screens • You do not want to use third-party solutions like this, nor do you want to wire everything up together yourself by following the docs • You do want to use the existing “navigation-safe-args-gradle-plugin” gradle plugin as explained here. If someone fulfills all of the above, this would be the last legit reason I can imagine someone having to going that hybrid approach still.
j
If youre talking about a new app, I would never use Fragments ever again. But if having an app already using Fragments, there is not an issue mixing them. However I recommend having strategy of migrate away from Fragments, if you intend to use Compose. Nothing wrong with Fragments itself, just that I dont see any reasons of using them anymore.