Most apps have some kind of preferences or user settings that can be stored via the SharedPreferences. My first implementation of an activity for the user to edit his settings was pretty straight forward: a couple of input fields and a 'Save' Button. This is neither pretty nor easily extensible.
The android system settings and many apps that I have seen tend to layout their preference editing in ListViews.
My second approach tries to imitate this: a ListActivity and every item has to supply it's own layout, since I want to store different types of values (some are numbers, some are boolean radio buttons).
I am finding it rather cumbersome to implement this and now I am wondering if I am missing some obvious design pattern here?
Just use PreferenceActivity
, it will build the UI and handle the preferences persistence for you. Here you have more documentation:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With