Overriding DialogPreference's default BACK keypress behaviour
By default, when in DialogPreference you press BACK button, it mimics that you've pressed NegativeButton.
I'd like to override that but c开发者_如何学Pythonan't find an easy way except to recreate DialogPreference from scratch (which at the moment seems like an overkill), because I'd like that PositiveButton SET something, NegativeButton to UNSET something, and BACK key to leave things as they were (ie. to not unset something).
Is there a simple solution to this?
I've even tried to override showDialog() but: a) its not simple, b) I don't think I should mess too much with internals of OS supplied code like a bunch of private "m" variables.
Thank you for your time...
Hmm, I haven't found any simple way to do it, so I've subclassed Preference and made what I needed with my own AlertDialog...
I've seen in Android source code that it bluntly sets NEGATIVE_BUTTON as default, disallowing doing what I intended (ignoring dismissal of Dialog in DialogPreference with BACK button)
精彩评论