Example usage for android.preference RingtonePreference setSummary

List of usage examples for android.preference RingtonePreference setSummary

Introduction

In this page you can find the example usage for android.preference RingtonePreference setSummary.

Prototype

public void setSummary(CharSequence summary) 

Source Link

Document

Sets the summary for this Preference with a CharSequence.

Usage

From source file:monakhv.android.samlib.SamlibPreferencesActivity.java

private void updateRingtoneSummary(RingtonePreference preference, Uri ringtoneUri) {
    Ringtone ringtone = RingtoneManager.getRingtone(this, ringtoneUri);
    if (ringtone != null) {
        preference.setSummary(ringtone.getTitle(this));
    } else {/*from   ww  w .  j  ava 2s . c  om*/
        preference.setSummary(getString(R.string.pref_no_sound));
    }

}

From source file:com.googlecode.mindbell.MindBellPreferences.java

/**
 * Sets the ringtone title into the summary of the ringtone preference.
 *
 * @param preferenceRingtone/*from ww w .j  a  v  a2  s .co m*/
 * @param uriString
 */
private void setPreferenceRingtoneSummary(RingtonePreference preferenceRingtone, String uriString) {
    CharSequence summary;
    if (uriString == null || uriString.isEmpty()) {
        summary = getText(R.string.summaryRingtoneNotSet);
    } else {
        Uri ringtoneUri = Uri.parse(uriString);
        Ringtone ringtone = RingtoneManager.getRingtone(this, ringtoneUri);
        summary = ringtone.getTitle(this);
    }
    preferenceRingtone.setSummary(summary);
}