2

I'm trying to make a custom setting in my application's PreferenceActivity that brings up a Dialog which will ultimately have the following

  1. An EditText to specify a server
  2. A Button for testing the server connection
  3. A response Icon specifying if the server has been reached

I am making some progress creating a custom Dialog, but I've also encountered the DialogPreference class which seems to be useful for this type of feature.

I'm wondering if there is any reason for me to start trying to use DialogPreference or if it is reasonable for me to continue toying around with a simple custom Dialog.

Will I run into any problems with either?

prolink007
  • 33,872
  • 24
  • 117
  • 185
Robin Newhouse
  • 2,158
  • 2
  • 19
  • 17

1 Answers1

2

I would suggest using the DialogPreference. DialogPreference is provided to you for this exact situation. And you should not run into any problems.

However, if you are already almost done... then continue with what you have.

Also, if you are wanting your DialogPreference to launch other dialogs, like confirmations or whatever, you should use Dialog.

prolink007
  • 33,872
  • 24
  • 117
  • 185
  • What would be the best way to use DialogPreference. The implementation seems rather messy and I'm finding very little documentation. Maybe you have a good resource you could direct me to? – Robin Newhouse Jul 31 '12 at 19:38
  • The only thing that i do to get it to work correctly is just override `onCreateDialogView()`. Set the `Dialog` layout with `setDialogLayoutResource(...)` and get the `View` with `super.onCreateView()`. I have done this a couple times with stuff where i work and it works fine. – prolink007 Jul 31 '12 at 19:46