j

    Jrichards1408

    1 year ago
    Hi. how do i use jetpack composes setContent {} inside a fragment?
    Andrey Kulikov

    Andrey Kulikov

    1 year ago
    ``class MyFragment : Fragment() {` `override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ) = ComposeView(requireContext()).apply { setContent() { Text("Hi") } } ) }``
    j

    Jrichards1408

    1 year ago
    thanks
    Fudge

    Fudge

    1 year ago
    Or just .setContent{} instead of .apply{setContent(){}}
    j

    Jrichards1408

    1 year ago
    sweet ok thanks
    wisdom

    wisdom

    1 year ago
    Helpful
    Adam Powell

    Adam Powell

    1 year ago
    apply is important here because the onCreateView function must return a View