当前位置: 首页>>代码示例>>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;未经允许,请勿转载。