0

I am converting my app to Compose,

class BinDetailDialogFragment  //private View pic;
: DialogFragment() {
   override fun onCreateView(
    inflater: LayoutInflater,
    container: ViewGroup?,
    savedInstanceState: Bundle?
): View? {
    return ComposeView(requireContext()).apply {
        setContent {
            Text(
                text = "This is Recipe Fragment",
                style = TextStyle(
                    fontSize = TextUnit.Sp(21)
                )
            )
        }
    }
 }
}

when I open dialogFragment:

    activity?.supportFragmentManager?.let {
    BinDetailDialogFragment.newInstance().show(it, BinDetailDialogFragment.TAG)
}

it throws

java.lang.NoSuchMethodError: No virtual method setContent(Lkotlin/jvm/functions/Function0;)V in class Landroidx/compose/ui/platform/ComposeView; or its super classes (declaration of 'androidx.compose.ui.platform.ComposeView' appears in
Nurseyit Tursunkulov
  • 8,012
  • 12
  • 44
  • 78
  • 1
    Does this answer your question? [Jetpack Compose dev06 setContent() doesn't work?](https://stackoverflow.com/questions/60615308/jetpack-compose-dev06-setcontent-doesnt-work) – Mohammad Sianaki Dec 24 '20 at 09:07

0 Answers0