當前位置: 首頁>>代碼示例>>Java>>正文


Java ListPreference.getEntries方法代碼示例

本文整理匯總了Java中android.preference.ListPreference.getEntries方法的典型用法代碼示例。如果您正苦於以下問題:Java ListPreference.getEntries方法的具體用法?Java ListPreference.getEntries怎麽用?Java ListPreference.getEntries使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.preference.ListPreference的用法示例。


在下文中一共展示了ListPreference.getEntries方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onPreferenceChange

import android.preference.ListPreference; //導入方法依賴的package包/類
@Override
public boolean onPreferenceChange(Preference preference, Object value) {
    String stringValue = value.toString();

    if (preference instanceof ListPreference) {
        ListPreference listPreference = (ListPreference) preference;
        int prefIndex = listPreference.findIndexOfValue(stringValue);
        if (prefIndex >= 0) {
            CharSequence[] labels = listPreference.getEntries();
            preference.setSummary(labels[prefIndex]);
        }
    } else {
        preference.setSummary(stringValue);
    }
    return true;
}
 
開發者ID:rahul051296,項目名稱:quake-alert-android-app,代碼行數:17,代碼來源:SettingsActivity.java

示例2: onPreferenceChange

import android.preference.ListPreference; //導入方法依賴的package包/類
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
    String stringValue = newValue.toString();
    if (preference instanceof ListPreference) {
        ListPreference listPreference = (ListPreference) preference;
        int prefIndex = listPreference.findIndexOfValue(stringValue);
        if (prefIndex >= 0) {
            CharSequence[] labels  = listPreference.getEntries();
            preference.setSummary(labels[prefIndex]);
        }

    }else {
        preference.setSummary(stringValue);
    }
    return true;
}
 
開發者ID:wenzhifeifeidetutu,項目名稱:QuakeRepor,代碼行數:17,代碼來源:SettingActivity.java

示例3: removeListEntry

import android.preference.ListPreference; //導入方法依賴的package包/類
private void removeListEntry(ListPreference listPreference, String remove) {
    CharSequence[] entryValues = listPreference.getEntryValues();
    CharSequence[] entries = listPreference.getEntries();

    CharSequence[] newEntryValues = new String[entryValues.length - 1];
    CharSequence[] newEntries = new String[entryValues.length - 1];

    for (int i = 0, out = 0; i < entryValues.length; i++) {
        CharSequence value = entryValues[i];
        if (!value.equals(remove)) {
            newEntryValues[out] = value;
            newEntries[out] = entries[i];
            out++;
        }
    }

    listPreference.setEntryValues(newEntryValues);
    listPreference.setEntries(newEntries);
}
 
開發者ID:philipwhiuk,項目名稱:q-mail,代碼行數:20,代碼來源:AccountSettings.java

示例4: onPreferenceChange

import android.preference.ListPreference; //導入方法依賴的package包/類
@Override
public boolean onPreferenceChange(Preference preference, Object value) {
    String stringValue = value.toString();
    if (preference instanceof ListPreference) {
        ListPreference listPreference = (ListPreference) preference;
        int prefIndex = listPreference.findIndexOfValue(stringValue);
        if (prefIndex >= 0) {
            CharSequence[] labels = listPreference.getEntries();
            preference.setSummary(labels[prefIndex]);
        }
    } else {
        preference.setSummary(stringValue);
    }
    return true;
}
 
開發者ID:akspan12,項目名稱:Earthquake-report-app,代碼行數:16,代碼來源:SettingsActivity.java

示例5: updateListPreferenceSummaryToCurrentValue

import android.preference.ListPreference; //導入方法依賴的package包/類
static void updateListPreferenceSummaryToCurrentValue(final String prefKey,
        final PreferenceScreen screen) {
    // Because the "%s" summary trick of {@link ListPreference} doesn't work properly before
    // KitKat, we need to update the summary programmatically.
    final ListPreference listPreference = (ListPreference)screen.findPreference(prefKey);
    if (listPreference == null) {
        return;
    }
    final CharSequence entries[] = listPreference.getEntries();
    final int entryIndex = listPreference.findIndexOfValue(listPreference.getValue());
    listPreference.setSummary(entryIndex < 0 ? null : entries[entryIndex]);
}
 
開發者ID:rkkr,項目名稱:simple-keyboard,代碼行數:13,代碼來源:SubScreenFragment.java

示例6: onPreferenceChange

import android.preference.ListPreference; //導入方法依賴的package包/類
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
    String stringValue = newValue.toString();
    if (preference instanceof ListPreference) {
        ListPreference listPreference = (ListPreference) preference;
        int prefIndex = listPreference.findIndexOfValue(stringValue);
        if (prefIndex >= 0) {
            CharSequence[] labels = listPreference.getEntries();
            preference.setSummary(labels[prefIndex]);
        }
    }else {
        preference.setSummary(stringValue);
    }
    return true;
}
 
開發者ID:ECFK75C8,項目名稱:Lagos-Developers-App,代碼行數:16,代碼來源:Settings.java

示例7: onPreferenceChange

import android.preference.ListPreference; //導入方法依賴的package包/類
@Override
public boolean onPreferenceChange(Preference preference, Object o) {
    String stringValue = o.toString();
    if (preference instanceof ListPreference) {
        ListPreference listPreference = (ListPreference) preference;
        int prefIndex = listPreference.findIndexOfValue(stringValue);
        if (prefIndex >= 0) {
            CharSequence[] labels = listPreference.getEntries();
            preference.setSummary(labels[prefIndex]);
        }
    } else {
        preference.setSummary(stringValue);
    }
    return true;
}
 
開發者ID:ganeshmukesh123,項目名稱:Quake-report,代碼行數:16,代碼來源:SettingsActivity.java

示例8: onPreferenceChange

import android.preference.ListPreference; //導入方法依賴的package包/類
public boolean onPreferenceChange(Preference preference, Object newValue) {
   String stringvalue=newValue.toString();
    if (preference instanceof ListPreference) {
        ListPreference listPreference = (ListPreference) preference;
        int prefIndex = listPreference.findIndexOfValue(stringvalue);
        if (prefIndex >= 0) {
            CharSequence[] labels = listPreference.getEntries();
            preference.setSummary(labels[prefIndex]);
        }
    } else {
        preference.setSummary(stringvalue);
    }
    return true;
}
 
開發者ID:raghu619,項目名稱:andriodapp,代碼行數:15,代碼來源:SettingsActivity.java


注:本文中的android.preference.ListPreference.getEntries方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。