I need to add Preference in ICS using addPreferencesFromResource().
It is shown as deprecated in ICS.
I’ve added a preference layout in xml folder but this could not be added to the Preference activity.
How can I add it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
On API Level 11 and higher, the plan is for you to use
PreferenceFragmentsto calladdPreferencesFromResource(). You can see an example of this in the documentation forPreferenceActivity.If you are trying to support
PreferenceFragmenton API Level 11+, yet still support older devices, you will need to do both the stuff shown in that documentation and calladdPreferencesFromResource()directly in yourPreferenceActivity… but only when you are on an older device. Even thoughaddPreferencesFromResource()is marked as deprecated, that does not mean that it does not work, and more importantly it is your only option on API Level 10 and below.Here is a sample project where I demonstrate supporting both API Level 11-style fragments and the classic
PreferenceActivityfrom a single set of source.