PreferenceScreen screen = new PreferenceScreen();
and use addPreference to add preferences to the screen. In PreferenceFragment (or PreferenceActivity, if you don’t use Fragment), just call setPreferenceScreen with hierarchy after construction.
I want to create a preference screen without writing an XML layout file. I want to store the settings in SQLite In the database. Is this possible?
You can use the following command to create a preference hierarchy (possibly in onCreate() of PreferenceFragment):
< pre>PreferenceScreen screen = new PreferenceScreen();
and use addPreference to add the preferences to the screen. In PreferenceFragment (or PreferenceActivity, if you don’t use fragments), just call with hierarchy after construction setPreferenceScreen.