public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { mLogger.info("saw pref key " + key); if (key.equals(SettingsActivity.KEY_BTC_UNITS)) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); String btcUnits = sharedPref.getString(SettingsActivity.KEY_BTC_UNITS, ""); setBTCUnits(btcUnits); } }
@Override public void onCreate() { // Apply PRNGFixes. PRNGFixes.apply(); initLogging(); super.onCreate(); // Log the About contents so we have the version string. mLogger.info(getResources().getString(R.string.about_contents)); SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); String btcUnits = sharedPref.getString(SettingsActivity.KEY_BTC_UNITS, ""); setBTCUnits(btcUnits); // Register for future preference changes. sharedPref.registerOnSharedPreferenceChangeListener(this); mLogger.info("WalletApplication created"); }