0

I've gone through several questions and articles in the web and almost all of them seem to be pointing towards starting an Custom class which extends PreferenceActivity.

But then in the Android reference documents, it instructs to use preferencefragment.

What is the correct method to using it?

(I'm only asking because doing it through an activity has addPreferencesFromResource() as deprecated)

Assumption: api level 15

gaara87
  • 2,087
  • 3
  • 21
  • 43

1 Answers1

1

The answer is, it depends on what platform you are developing for. The PreferenceFragment is for 3.0+ and is now considered the proper way to do it. Unfortunately, there is not an equivalent in the support library for the older platforms, so for those you need to use a PreferenceActivity.

See here for a more in-depth explanation and a link to an example implementing both (uses the proper type depending on device platform).

Community
  • 1
  • 1
Barak
  • 16,318
  • 9
  • 52
  • 84