一找到首选项的选择XML文件 private ListPreference mButtonPreferredNetworkMode; mButtonPreferredNetworkMode =(ListPreference) prefSet.findPreference( BUTTON_PREFERED_NETWORK_MODE); 布局文件Msim_network_sub_setting.xml: <ListPreference android:key="preferred_network_mode_key" android:title="@string/preferred_network_mode_title" android:summary="@string/preferred_network_mode_summary" android:entries="@array/preferred_network_mode_choices" android:entryValues="@array/preferred_network_mode_values"
android:dialogTitle="@string/preferred_network_mode_dialogtitle"/>
上述方式的设置列表值是通过直接在布局文件里面设置所有的默认选项,然后可以在程序中进行重新复制
Strings.xml [url=]packages\services\telephony\res\values[/url]
<string-array name="preferred_network_mode_values" translatable="false"> <item>"23"</item> …………………………… <item>"2"</item> <item>"1"</item> <item>"0"</item> </string-array> <string-arrayname="preferred_network_mode_choices"translatable="false"> <item>@string/preferred_network_mode_lte_cdma_evdo_gsm_choice</item> ………………………………………………… <item>@string/preferred_network_mode_wcdma_only_choice</item> <item>@string/preferred_network_mode_gsm_only_choice</item> <item>@string/preferred_network_mode_gsm_wcdma_preferred_choice</item> </string-array> 二判断哪种运营商 1 MSimMobileNetworkSubSettings.java [url=]\\packages\services\telephony\src\com\android\phone\msim[/url] /**begin add by liting in 20151212**/ private void changeNeworkTypeList(Stringnumber){ if("46003".equals(number)||"46005".equals(number)||"46011".equals(number)){ mButtonPreferredNetworkMode.setEntries(R.array.preferred_china_telecom_choices); mButtonPreferredNetworkMode.setEntryValues(R.array.preferred_china_telecom_values); }elseif("46000".equals(number)||"46002".equals(number)||"46007".equals(number)){ mButtonPreferredNetworkMode.setEntries(R.array.preferred_china_mobile_choices); mButtonPreferredNetworkMode.setEntryValues(R.array.preferred_china_mobile_values); }elseif("46001".equals(number)||"46006".equals(number)||"46009".equals(number)){ mButtonPreferredNetworkMode.setEntries(R.array.preferred_china_union_choices); mButtonPreferredNetworkMode.setEntryValues(R.array.preferred_china_union_values); }else{ mButtonPreferredNetworkMode .setEntries(R.array.preferred_network_mode_choices); mButtonPreferredNetworkMode.setEntryValues( R.array.preferred_network_mode_values); } } /**end by liting in 20151212**/ 通过setEntries和setEntryValues方法设置另外的值。
2 找到plmn TelephonyManager.getDefault().getIccOperatorNumeric(SubscriptionManager.getSubId(0)[0]); TelephonyManager mTelephonyManager =(TelephonyManager) getSystemService(Service.TELEPHONY_SERVICE); Stringimsi = mTelephonyManager.getSubscriberId(SubscriptionManager.getSubId(mPhone.getPhoneId())[0]); String ICCID = mTelephonyManager.getSimSerialNumber(SubscriptionManager.getSubId(mPhone.getPhoneId())[0]);
|