Preference getKey - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Preference getKey method.

This code example shows how to use the following methods:getKey, setDependency
        } 
 
    } 
 
    private void setHapticButtonDep() { 
        mHapticFeedbackUpPref.setDependency(mHapticFeedbackPref.getKey());
        mHapticFeedbackAllPref.setDependency(mHapticFeedbackUpPref.getKey());
    } 
 
    public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
        if (HAPTIC_FEEDBACK_PREF.equals(key)) {
            Settings.System.putInt(getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED,
                    mHapticFeedbackPref.isChecked() ? 1 : 0);
        } else if (HAPTIC_FEEDBACK_UP_PREF.equals(key)) {
            Settings.System.putInt(getContentResolver(),
                    Settings.System.HAPTIC_FEEDBACK_UP_ENABLED, 
                    mHapticFeedbackUpPref.isChecked() ? 1 : 0);
        } else if (HAPTIC_FEEDBACK_ALL_PREF.equals(key)) {
            Settings.System.putInt(getContentResolver(),
                    Settings.System.HAPTIC_FEEDBACK_ALL_ENABLED, 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getKey
 
    @Override 
    public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
 
        String boxValue;
        String key = preference.getKey();
 
        Log.w(TAG, "key: " + key);
 
        return true; 
    } 
 
    public static boolean isSupported(String FILE) {
        return Utils.fileExists(FILE);
    } 
 
    public static void restore(Context context) {
        SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
    } 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setSummary, setValue, getKey
            updateEntry(pref);
        } 
    } 
 
    private void updateEntry(ListPreference pref) {
        String value = Settings.System.getString(getContentResolver(), pref.getKey());
        if (value == null) {
            value = "";
        } 
 
        CharSequence entry = findEntryForValue(pref, value);
        if (entry != null) {
            pref.setValue(value);
            pref.setSummary(entry);
            return; 
        } 
    } 
 
    private CharSequence findEntryForValue(ListPreference pref, CharSequence value) {
        CharSequence[] entries = pref.getEntryValues();
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getKey
 
    @Override 
    public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
 
        String boxValue;
        String key = preference.getKey();
 
        Log.w(TAG, "key: " + key);
 
        return true; 
    } 
 
    public static boolean isSupported(String FILE) {
        return Utils.fileExists(FILE);
    } 
 
    public static void restore(Context context) {
        SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
    } 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getKey, setOnPreferenceChangeListener
     * immediately updated upon calling this method. The exact display format is 
     * dependent on the type of preference. 
     */ 
    public static void bindPreferenceSummaryToValue(SharedPreferences prefs, Preference preference) {
        // Set the listener to watch for value changes. 
        preference.setOnPreferenceChangeListener(sSetSummaryListener);
 
        // Trigger the listener immediately with the preference's current value. 
        sSetSummaryListener
                .onPreferenceChange(preference, prefs.getString(preference.getKey(), ""));
    } 
 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getContext, getKey, setOnPreferenceChangeListener
	 * @see #sBindPreferenceSummaryToValueListener 
	 */ 
	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(),
						"")); 
	} 
 
	/** 
	 * This fragment shows general preferences only. It is used when the 
	 * activity is showing a two-pane settings UI. 
	 */ 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getKey
        } 
    } 
 
    @Override 
    public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
        if (preference.getKey().equals(BUTTON_VP_KEY)) {
            return true; 
        } 
        return false; 
    } 
 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getContext, getKey, setOnPreferenceChangeListener
     * immediately called with the preference's current value upon calling this method. 
     */ 
    public static void setAndCallPreferenceChangeListener(Preference preference,
            Preference.OnPreferenceChangeListener listener) {
        // Set the listener to watch for value changes. 
        preference.setOnPreferenceChangeListener(listener);
 
        // Trigger the listener immediately with the preference's 
        // current value. 
        listener.onPreferenceChange(preference,
                PreferenceManager 
                        .getDefaultSharedPreferences(preference.getContext())
                        .getString(preference.getKey(), ""));
    } 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getKey
                " ruimSupported=" + ruimSupported);
        return (nvSupported && ruimSupported);
    } 
 
    public boolean preferenceTreeClick(Preference preference) {
        if (preference.getKey().equals(BUTTON_CDMA_SYSTEM_SELECT_KEY)) {
            log("preferenceTreeClick: return BUTTON_CDMA_ROAMING_KEY true"); 
            return true; 
        } 
        if (preference.getKey().equals(BUTTON_CDMA_SUBSCRIPTION_KEY)) {
            log("preferenceTreeClick: return CDMA_SUBSCRIPTION_KEY true"); 
            return true; 
        } 
        return false; 
    } 
 
    public void showDialog(Preference preference) {
        if (preference.getKey().equals(BUTTON_CDMA_SYSTEM_SELECT_KEY)) {
            mButtonCdmaSystemSelect.showDialog(null);
        } else if (preference.getKey().equals(BUTTON_CDMA_SUBSCRIPTION_KEY)) {
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getKey, setSummary
	private static Preference.OnPreferenceChangeListener update_summary_pref_listener = new Preference.OnPreferenceChangeListener() {
		@Override 
		public boolean onPreferenceChange(Preference preference, Object value) { 
			String string_value = value.toString(); 
			if (preference instanceof EditTextPreference) { 
				String key = preference.getKey(); 
				if (key.equals("path_to_packages")) 
					preference.setSummary("Obtain packages at " + string_value); 
				else if (key.equals("compilation_timeout")) 
					preference.setSummary(string_value + " minutes"); 
				else 
					preference.setSummary(string_value); 
			} 
			return true; 
		} 
	}; 
 
	private static void bindPreferenceSummaryToValue(Preference preference) {
		// Set the listener to watch for value changes. 
		preference.setOnPreferenceChangeListener(update_summary_pref_listener);
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Preference getKey Questions & Answers:

getKey Method Overview
Gets the key for this Preference, which is also the key used for storing values into SharedPreferences.
See Code Examples for other Android Preference Methods: