Deprecated Preference Activity method

Viewed 8431

I am working with PreferenceActivity but when I call my preference xml(prefs.xml) with the help of addPreferencesFromResource() it says this method is deprecated and "This function is not relevant for a modern fragment-based PreferenceActivity". Is there any alternative of this method? How can I handle this?

package com.adi.preferencedemotest;

public class PrefsActivity extends PreferenceActivity {
    @SuppressWarnings("deprecation") <-------
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.prefs); <-------
    }

}

Note: may be my question rates as a duplicated but I didn't find any.

1 Answers
Related