Questions tagged [dialog-preference]

A class in the Android preferences framework that allows applications to implement custom user interfaces for editing a preference setting.

A class in the Android preferences framework that allows applications to implement custom user interfaces for editing a preference setting.

A very useful guide for writing DialogPreference implementations can be found in this answer: Concise way of writing new DialogPreference classes?

67 questions
119
votes
3 answers

How to implement a confirmation (yes/no) DialogPreference?

How can I implement a Preference that displays a simple yes/no confirmation dialog? For an example, see Browser->Setting->Clear Cache.
sh1ng
  • 2,808
  • 4
  • 24
  • 38
29
votes
2 answers

Why won't Fragment retain state when screen is rotated?

I've been having some trouble getting some custom DialogPreference subclasses inside a PreferenceFragment to remain visible when the screen is rotated. I don't experience this problem when using a PreferenceActivity, so I don't know whether it's an…
14
votes
1 answer

Get positive Button in DialogPreference

Is there a way to get the positive button of a DialogPreference in any of its events? I would like to disable it initially, and make it enabled once a EditText validates.
Bridget the Midget
  • 842
  • 10
  • 21
11
votes
1 answer

DialogPreference cause error onDisplayPreferenceDialog()

I would like to create a simple (yes/no) dialog preference, I followed the the answers in this post - creating a DialogPreference from XML But I get an error saying java.lang.IllegalArgumentException: Tried to display dialog for unknown preference…
10
votes
3 answers

Alertdialog.Builder setview: Call requires API level 21

I am trying to get a radius NumberPicker running in a class that extends DialogPreference, and I am having a lot of trouble getting setView() to work. Let's start with some code: public class RadiusPickerPreference extends DialogPreference{ …
pat_brat
  • 466
  • 1
  • 5
  • 11
10
votes
4 answers

onUserInteraction not working in DialogPreference

It is expected that onUserInteraction is being called for any user interaction. it works fine in PreferenceActivity. However, when a DialogPreference is popup, onUserInteraction is not called anymore even there is user interaction such as touch…
Bear
  • 5,138
  • 5
  • 50
  • 80
10
votes
1 answer

Android: Is there a way to show DialogPreference from code?

I want to open some preferences (which are made by extending DialogPreference) on first app startup. Also, these preferences are used as usual preferences. Is there a way of accomplishing this? EDIT: I have my custom preference, made like…
Prizoff
  • 4,486
  • 4
  • 41
  • 69
9
votes
1 answer

How to properly implement onRestoreInstanceState() for a DialogPreference subclass?

I am implementing my own custom DialogPreference subclass that has a SeekBar used for persisting an integer. I'm a little confused about what needs to go into onSaveInstanceState() and onRestoreInstanceState(). Specifically, do you need to update…
8
votes
4 answers

Create NumberPicker dialog in preference

I am trying to create a NumberPicker dialog in my preference screen. I have already made one following this:https://stackoverflow.com/a/5533295/2442638 However, for my second dialog, I only want one spinner, so I have adapted the code as…
user2442638
7
votes
2 answers

Android: support %s expansion in DialogPreference summary

first question. long time searcher. i implemented a timePicker preference through expansion of DialogPreference as in the android docs. all works well and i can set the summary through onSharedPreferenceChanged() and also in the override of…
5
votes
2 answers

TimePickerDialog with Neutral button

I have a TimePickerDialog preference with a "TimePreference" class which extends DialogPreference: public class TimePreference extends DialogPreference{ ... private TimePicker picker=null; ... public TimePreference(Context ctxt, AttributeSet…
anestv
  • 543
  • 6
  • 28
5
votes
1 answer

How to make a custom Dialog Preference inside Preference

I searched all Around this forum , but not getting what i exactly need. I need a Custom DialogPreference in Preference but that DialogPreference shouldn't have blue-strip header which i hate, And i already prepared one activity header template xml…
4
votes
5 answers

Do not close DialogPreference onClick if condition not met

I have need for AutoCompliteTextView in PreferenceActivity so I extended DialogPreference. My auto-complite is expecting from (helping) user to enter country name. I'm fine if user press Cancel or enters no values, however I would like to ensure…
peter_budo
  • 1,748
  • 4
  • 26
  • 48
4
votes
1 answer

onBindDialogView not called - Why?

I am trying to implement a subclass of ListPreference and while its constructor is being called (upon displaying it), its overriden onBindDialogView isn't. public MyListPreference(Context context, AttributeSet attrs) { super(context, attrs); …
scatmoi
  • 1,958
  • 4
  • 18
  • 32
4
votes
1 answer

Why custom DialogPreference doesnt trigger on onSharedPreferenceChanged listener?

I am trying to make dialog preference in preferences, where user just click positive button to trigger some action. (Clear database? No | Yes) public class MyDialogPreference extends DialogPreference { public MyDialogPreference(Context context,…
urSus
  • 12,492
  • 12
  • 69
  • 89
1
2 3 4 5