39
I'm writing some custom preference dialogs in Android by extending the DialogPreference class. However, I'm getting a bit concerned at the amount of boiler plate code that is needed for this as there appears to be a lot of behaviour to test.
For instance, this example of a number preference dialog is fairly typical: http://svn.jimblackler.net/jimblackler/trunk/workspace/NewsWidget/src/net/jimblackler/newswidget/NumberPreference.java
In particular, the onSave()/RestoreInstanceState() methods and "class SavedState" parts, which are needed so that the current changes to the dialog are retained on orientation changes are quite verbose and complex.
Does anyone have any tips for writing DialogPreference classes in a more concise way?