Advertisement

How to create Preference Fragment in Android? Steps to follow given in description box..

How to create Preference Fragment in Android? Steps to follow given in description box.. Steps to create a Preference Fragment:
1. Create a folder 'xml' in you res folder
2. Create an xml resource file in this xml folder name it as preferences.xml
3. Design your preferences.xml file according to your application.
4. Create a sub class of PreferenceFragment class and override onCreate() of this class.
5. Write the following into it
--- addPreferencesFromResource(R.xml.preferences);
6. Go to your MainActivity.java file and simply load your PreferenceFragment with the help of FragmentManager and FrangmentTransaction class.

box..

Post a Comment

0 Comments