Back to project page Android-Universal-Notifier.
The source code is released under:
Apache License
If you think the Android project Android-Universal-Notifier 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.mairos.universalnotifier.UI; // w w w . j a v a 2 s.c om import com.mairos.universalnotifier.R; import com.mairos.universalnotifier.model.Const; import com.mairos.universalnotifier.model.TasksQueue; import android.os.Bundle; import android.preference.Preference; import android.preference.PreferenceActivity; import android.preference.PreferenceManager; import android.util.Log; public class SettingsActivity extends PreferenceActivity { @SuppressWarnings("deprecation") @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); addPreferencesFromResource(R.xml.pref_general); bindPreferenceSummaryToValue(findPreference("tasks_URL")); } private static void bindPreferenceSummaryToValue(Preference preference) { // Set the listener to watch for value changes. preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener); // Trigger the listener immediately with the preference's // current value. sBindPreferenceSummaryToValueListener.onPreferenceChange( preference, PreferenceManager.getDefaultSharedPreferences( preference.getContext()).getString(preference.getKey(), "")); } private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object value) { Log.d(Const.LOG_TAG, "onPreferenceChange value = " + value); String stringValue = value.toString(); preference.setSummary(stringValue); TasksQueue.setTasksURL(stringValue); return true; } }; }