Sam Stone
04/08/2022, 3:58 AMClassCastException: LinkedHashMap can't be cast to X
When using by lazy{X}
? I think this is the second time, though haven't had it in a while. Code:
class MyFragment : Fragment() {
private val foo by lazy { MyDialogFragment(params) }
fun myFun() {
foo.show()
}
}
tseisel
04/08/2022, 7:41 PMDialogFragment
as a class variable of another fragment feels like a memory leak to me. That may be the cause of your problem.lam bui
04/09/2022, 3:37 AMtseisel
04/09/2022, 8:36 AMDialogFragment
is recorded in the fragment manager, you should not need to keep an explicit reference to it. You can retrieve a fragment from the fragment manager given its tag