Currently we can show classic Android views with `...
# compose
Currently we can show classic Android views with
composable. I'm curious if there will be a way to show `Fragment`s in composables? Maybe it's already possible (I haven't tried yet). Maybe we can wrap fragment within a
or something? The reason why I'm asking is that we're thinking of moving our app navigation to be within composables. All our screens are
s at the moment and ideally we would like to avoid converting each fragment to a custom view (before we can convert each of them to be composables)
Copy code
override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        val fragmentView = inflater.inflate(R.layout.fragment_home, container, false)

        (fragmentView as FrameLayout).setContent(Recomposer.current()) {
                // Compose code
        return fragmentView
This works for me - fragment xml is just a framelayout 🙂
👍 1
Sorry I may have been not clear enough. I want it the other way around. I want fragments to render within composables, not composables to render within fragments So for us to slowly migrate our views - your suggestion would work. But we want to migrate our navigation and for that we want to render fragments within composables
Ooh, okay, sorry. 😓
It's OK. Your suggestion will be useful for view migration! So thanks for that
😊 1
Accidentally, @yennsarah is exactly what I was looking for. Soo much thanks. This makes it easy to use compose with the current navigation api
👍 2