Reputation: 41
I want to create a preferences screen without writing an XML layout file. I'd like to store the settings in a SQLite database. Is this possible?
Upvotes: 4
Views: 964
Reputation: 234795
You can simply create a preference hierarchy (probably in onCreate()
for the PreferenceFragment
) with:
PreferenceScreen screen = new PreferenceScreen();
and add preference items to screen
using addPreference
. In the PreferenceFragment
(or PreferenceActivity
, if you aren't using fragments), just call setPreferenceScreen
with the hierarchy after it's constructed.
Upvotes: 1