I’d like to know what is the best way to use shared preferences for application settings, namely to change text size and text colour. The tutorials I am finding are all confusing and most of them are using deprecated methods. What is the best way to proceed for API 17?
Share
Create a preferences screen using this so your users have a place to change values. In your code, check the value of the keys you used in this preference screen and do whatever you need to do.
By the way, the example in the Android doc I linked shows hard-coded key string literals. The best practice way to do this is to create string keys in strings.xml resource file and reference the string key in your preference screen xml file and in your java code.
For example, in strings.xml:
In you preference screen xml file:
In your java code: