StackOverflowError when trying to inflate a custom layout for an AlertDialog inside a DialogFragment

后端 未结 3 1289
野趣味
野趣味 2021-02-12 13:50

I\'m trying to create an AlertDialog, by using the Builder and setting a custom view. When I try to inflate the view inside of onCreateDialog, I get a StackOverflowError..

3条回答
  •  醉酒成梦
    2021-02-12 14:16

    You should use LayoutInflater.from(getContext()).

    If you are using viewbindings you can call it like this:

    binding = FragmentOtpDialogBinding.inflate(LayoutInflater.from(getContext()));

提交回复
热议问题