I want to have a custom dialog (created using layout) in Preferences
. What should I do to declare this custom dialog in my preferences?
Asked
Active
Viewed 2.2k times
8

CopsOnRoad
- 237,138
- 77
- 654
- 440

Eugene
- 59,186
- 91
- 226
- 333
1 Answers
6
Implement a DialogPreference for your custom layout and add that preference to your preference screen
Here is a good explanation of how to do this: Concise way of writing new DialogPreference classes?

Community
- 1
- 1

Christopher Souvey
- 2,890
- 21
- 21
-
Cool. Do you know how to hook this new class to SharedPreferences themselves? – Eugene Sep 17 '11 at 18:09
-
The StackOverflow answer I linked explains how to persist data using either helper methods or SharedPreferences – Christopher Souvey Sep 17 '11 at 18:12
-
Sorry, there is no a single work how to refer to the new class from your xml where you declare preference items. – Eugene Sep 17 '11 at 18:17
-
1In the XML, you must use the full name (including package) of your class that extends DialogPreference. See sample XML here: http://stackoverflow.com/questions/5516022/android-launch-a-custom-preference-from-a-preferenceactivity – Christopher Souvey Sep 17 '11 at 18:27