Back to project page TacoTool.
The source code is released under:
GNU General Public License
If you think the Android project TacoTool listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.example.tacotool; /* w w w. j a v a 2 s.c om*/ import android.os.Bundle; import android.preference.ListPreference; import android.preference.PreferenceActivity; import android.preference.PreferenceManager; import android.annotation.SuppressLint; import android.app.Activity; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.view.Menu; import android.view.View; @SuppressLint("NewApi") public class SettingsActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener{ @SuppressWarnings("deprecation") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // setContentView(R.layout.activity_settings); addPreferencesFromResource(R.xml.preferences); SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); // sharedPref.getString(key, defValue); SharedPreferences.Editor editor = sharedPref.edit(); getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. // getMenuInflater().inflate(R.menu.settings, menu); return false; } @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); // sharedPref.getString(key, defValue); ListPreference lp = (ListPreference) findPreference("taco_theme"); SharedPreferences.Editor editor = sharedPref.edit(); editor.putString("selected_taco_theme", lp.getEntry().toString()); editor.commit(); } }