Example usage for android.preference PreferenceScreen findPreference

List of usage examples for android.preference PreferenceScreen findPreference

Introduction

In this page you can find the example usage for android.preference PreferenceScreen findPreference.

Prototype

public Preference findPreference(CharSequence key) 

Source Link

Document

Finds a Preference based on its key.

Usage

From source file:com.google.sample.castcompanionlibrary.cast.VideoCastManager.java

/**
 * Updates the summary of the captions between "on" and "off" based on the user selected
 * preferences. This can be called by the caller application when they add captions settings to
 * their preferences. Preferably this should be called in the {@link onResume()} of the
 * PreferenceActivity so that it gets updated when needed.
 *//*from   w  ww . j  av a2  s  . c o m*/
public void updateCaptionSummary(String captionScreenKey, PreferenceScreen preferenceScreen) {
    int status = R.string.info_na;
    if (isFeatureEnabled(FEATURE_CAPTIONS_PREFERENCE)) {
        status = mTrackManager.isCaptionEnabled() ? R.string.on : R.string.off;
    }
    preferenceScreen.findPreference(captionScreenKey).setSummary(status);
}

From source file:com.google.android.libraries.cast.companionlibrary.cast.VideoCastManager.java

/**
 * Updates the summary of the captions between "on" and "off" based on the user selected
 * preferences. This can be called by the caller application when they add captions settings to
 * their preferences. Preferably this should be called in the {@code onResume()} of the
 * PreferenceActivity so that it gets updated when needed.
 *//*from  w ww  .ja  v  a 2  s . co m*/
public void updateCaptionSummary(String captionScreenKey, PreferenceScreen preferenceScreen) {
    int status = R.string.ccl_info_na;
    if (isFeatureEnabled(FEATURE_CAPTIONS_PREFERENCE)) {
        status = mTrackManager.isCaptionEnabled() ? R.string.ccl_on : R.string.ccl_off;
    }
    preferenceScreen.findPreference(captionScreenKey).setSummary(status);
}