当前位置: 首页>>代码示例>>Java>>正文


Java ListPreference.setDefaultValue方法代码示例

本文整理汇总了Java中android.preference.ListPreference.setDefaultValue方法的典型用法代码示例。如果您正苦于以下问题:Java ListPreference.setDefaultValue方法的具体用法?Java ListPreference.setDefaultValue怎么用?Java ListPreference.setDefaultValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.preference.ListPreference的用法示例。


在下文中一共展示了ListPreference.setDefaultValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeTransportPreference

import android.preference.ListPreference; //导入方法依赖的package包/类
private void initializeTransportPreference(ListPreference pref) {
	List<CharSequence> entries = new ArrayList<CharSequence>();
	List<CharSequence> values = new ArrayList<CharSequence>();
	entries.add(getString(R.string.pref_transport_udp));
	values.add(getString(R.string.pref_transport_udp_key));
	entries.add(getString(R.string.pref_transport_tcp));
	values.add(getString(R.string.pref_transport_tcp_key));

	if (!getResources().getBoolean(R.bool.disable_all_security_features_for_markets)) {
		entries.add(getString(R.string.pref_transport_tls));
		values.add(getString(R.string.pref_transport_tls_key));
	}
	setListPreferenceValues(pref, entries, values);

	if (! isNewAccount) {
		pref.setSummary(mPrefs.getAccountTransportString(n));
		pref.setDefaultValue(mPrefs.getAccountTransportKey(n));
		pref.setValueIndex(entries.indexOf(mPrefs.getAccountTransportString(n)));
	} else {

		pref.setSummary(getString(R.string.pref_transport_udp));
		pref.setDefaultValue(getString(R.string.pref_transport_udp));
		pref.setValueIndex(entries.indexOf(getString(R.string.pref_transport_udp)));
	}
}
 
开发者ID:treasure-lau,项目名称:Linphone4Android,代码行数:26,代码来源:AccountPreferencesFragment.java

示例2: setListPreferenceIconsPacksData

import android.preference.ListPreference; //导入方法依赖的package包/类
protected static void setListPreferenceIconsPacksData(ListPreference lp, Context context) {
    IconsHandler iph = GlobState.getIconsHandler(context);

    iph.loadAvailableIconsPacks();

    Map<String, String> iconsPacks = iph.getAllIconsThemes();

    CharSequence[] entries = new CharSequence[iconsPacks.size()];
    CharSequence[] entryValues = new CharSequence[iconsPacks.size()];

    int i = 0;
    for (String packageIconsPack : iconsPacks.keySet()) {
        entries[i] = iconsPacks.get(packageIconsPack);
        entryValues[i] = packageIconsPack;
        i++;
    }

    lp.setEntries(entries);
    lp.setDefaultValue(IconsHandler.DEFAULT_PACK);
    lp.setEntryValues(entryValues);
}
 
开发者ID:quaap,项目名称:LaunchTime,代码行数:22,代码来源:SettingsActivity.java

示例3: setRpcServerPreferenceData

import android.preference.ListPreference; //导入方法依赖的package包/类
private void setRpcServerPreferenceData(ListPreference lp) {
    NetworkInfo[] networks = ethereumNetworkRepository.getAvailableNetworkList();
    CharSequence[] entries = new CharSequence[networks.length];
    for (int ii = 0; ii < networks.length; ii++) {
        entries[ii] = networks[ii].name;
    }

    CharSequence[] entryValues = new CharSequence[networks.length];
    for (int ii = 0; ii < networks.length; ii++) {
        entryValues[ii] = networks[ii].name;
    }

    String currentValue = ethereumNetworkRepository.getDefaultNetwork().name;

    lp.setEntries(entries);
    lp.setDefaultValue(currentValue);
    lp.setValue(currentValue);
    lp.setSummary(currentValue);
    lp.setEntryValues(entryValues);
}
 
开发者ID:TrustWallet,项目名称:trust-wallet-android,代码行数:21,代码来源:SettingsFragment.java

示例4: fillLayout

import android.preference.ListPreference; //导入方法依赖的package包/类
@Override
public void fillLayout(final SipProfile account) {
	super.fillLayout(account);
	
	CharSequence[] states = new CharSequence[] {"act", "nsw", "nt", "qld", "sa", "tas", "vic", "wa"};
	
       accountState = new ListPreference(parent);
       accountState.setEntries(states);
       accountState.setEntryValues(states);
       accountState.setKey("state");
       accountState.setDialogTitle(R.string.w_iinet_state);
       accountState.setTitle(R.string.w_iinet_state);
       accountState.setSummary(R.string.w_iinet_state_desc);
       accountState.setDefaultValue("act");
       addPreference(accountState);
       
       String domain = account.reg_uri;
       if( domain != null ) {
        for(CharSequence state : states) {
        	String currentComp = "sip:sip."+state+".iinet.net.au";
        	if( currentComp.equalsIgnoreCase(domain) ) {
        		accountState.setValue(state.toString());
        		break;
        	}
        }
       }
       
       accountUsername.setTitle(R.string.w_iinet_username);
	accountUsername.setDialogTitle(R.string.w_iinet_username);
	accountPassword.setTitle(R.string.w_iinet_password);
	accountPassword.setDialogTitle(R.string.w_iinet_password);
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:33,代码来源:IiNet.java

示例5: updateDateFormatList

import android.preference.ListPreference; //导入方法依赖的package包/类
private void updateDateFormatList() {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
    Resources res = getResources();

    ListPreference dateFormatPref = (ListPreference) findPreference("dateFormat");
    String[] dateFormatsValues = res.getStringArray(R.array.dateFormatsValues);
    String[] dateFormatsEntries = new String[dateFormatsValues.length];

    EditTextPreference customDateFormatPref = (EditTextPreference) findPreference("dateFormatCustom");
    customDateFormatPref.setDefaultValue(dateFormatsValues[0]);

    SimpleDateFormat sdformat = new SimpleDateFormat();
    for (int i=0; i<dateFormatsValues.length; i++) {
        String value = dateFormatsValues[i];
        if ("custom".equals(value)) {
            String renderedCustom;
            try {
                sdformat.applyPattern(sp.getString("dateFormatCustom", dateFormatsValues[0]));
                renderedCustom = sdformat.format(SAMPLE_DATE);
            } catch (IllegalArgumentException e) {
                renderedCustom = res.getString(R.string.error_dateFormat);
            }
            dateFormatsEntries[i] = String.format("%s:\n%s",
                    res.getString(R.string.setting_dateFormatCustom),
                    renderedCustom);
        } else {
            sdformat.applyPattern(value);
            dateFormatsEntries[i] = sdformat.format(SAMPLE_DATE);
        }
    }

    dateFormatPref.setDefaultValue(dateFormatsValues[0]);
    dateFormatPref.setEntries(dateFormatsEntries);

    setListPreferenceSummary("dateFormat");
}
 
开发者ID:hichemcesar24,项目名称:Weather-Android,代码行数:37,代码来源:SettingsActivity.java

示例6: inflateCountrySelection

import android.preference.ListPreference; //导入方法依赖的package包/类
private void inflateCountrySelection() {
    ListPreference countrySelectionPreference = (ListPreference) findPreference(PreferencesUtils.PREFERENCES_SELECTED_COUNTRY);
    countrySelectionPreference.setEntries(LocaleUtils.getAvailableLocales());
    countrySelectionPreference.setEntryValues(LocaleUtils.getAvailableIso3Codes());
    countrySelectionPreference.setDefaultValue(LocaleUtils.getDeviceLocale(countrySelectionPreference.getContext()));
    countrySelectionPreference.setValueIndex(countrySelectionPreference.findIndexOfValue(Prefs.with(countrySelectionPreference.getContext()).read(countrySelectionPreference.getKey(), LocaleUtils.getDeviceLocale(countrySelectionPreference.getContext()))));
    bindPreferenceSummaryToValue(countrySelectionPreference);
}
 
开发者ID:GrenderG,项目名称:Protestr,代码行数:9,代码来源:SettingsActivity.java


注:本文中的android.preference.ListPreference.setDefaultValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。