Does anyone have a way to instantiate a DialogFrag...
# android
j
Does anyone have a way to instantiate a DialogFragment with an lambda?
google 1
Neither an
interface
or a function can be parcelized nor serialized
s
It's error prone to attach a lambda to a fragment
The operating system can recreate your fragment anytime
The lambda that you've set will be null the fragment is retreated. It's very likely to crash at runtime
If you want some sort of callback either use a view model to communicate or have the activity implement an interface
2 possible solutions