By preferences.xml an users choose a value from 4 by listpref. After first time that android runs preference(), when an users choose again another value by listfref, how execute preference()? Where I put preference() within my code? thanks!
In the MainActivity, I've
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
preference();
[...] my code: buttons, textview, etc [...]
private void preferences() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
CheckboxPreference = prefs.getBoolean("checkboxPref", true);
ListPreference = prefs.getString("listpref", "");