Closed liaohuqiu closed 9 years ago
Memory leaks? So, what do you think about View.setOnClickListener()
?
If I have a Customized View used in multiple Activity, and I want to show a dialog to show some information related to this Customized View
, do you mean that I should process the listener in every Activity?
View listeners are different. Your general listener is strongly referenced in the DialogFragment
when you pass an inner class of an Activity
you risk leaking the activity when you rotate the device.
To solve your problem can have a common ancestor of your activities or if that's really not the case you can always fork styled dialogs and do it your way (I guess there might already be some forks like that).
OK. Thank you for your nice explanation and your patient.
Hi, thank you for your effort. But your proposed changes cannot be merged because they go directly against the current architecture of styled dialogs. We don't want to support setting dialog listeners in builders since it's a very error-prone feature breaking correct handling of device rotation and causing memory leaks. There are also no plans to add such feature in future releases. The only safe approach for handling listeners is via target fragment and activity listeners.