Android 怎么去掉联系人、通话记录、拨号列表界面中的电话号码中间的空格?
前言
欢迎大家我分享和推荐好用的代码段~~
声明
欢迎转载,但请保留文章原始出处:
CSDN:http://www.csdn.net
雨季o莫忧离:http://blog.csdn.net/luckkof
正文
FILE: PhoneNumberFormatter.java
PATH: alps/packages/apps/contacts/src/com/android/contacts/Util
---------------------------------------------------------------------------------------------------------------------------
public static final void setPhoneNumberFormattingTextWatcher(Context context,
TextView textView, Handler handler) {
// Deleted
// new TextWatcherLoadAsyncTask(ContactsUtils.getCurrentCountryIso(context), textView, handler)
// .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void[]) null);
// End
}
FILE: PhoneNumberFormattingTextWatcher.java
PATH: alps/frameworks/base/telephony/java/android/Telephony
---------------------------------------------------------------------------------------------------------------------------
public PhoneNumberFormattingTextWatcher(String countryCode) {
/** M: Get test mode from SystemProperties, mtk04070, 2012.02.06 */
getTestMode();
if (countryCode == null) throw new IllegalArgumentException();
// mFormatter = PhoneNumberUtil.getInstance().getAsYouTypeFormatter(countryCode);
}
PATH: alps/frameworks/base/telephony/java/android/Telephony
---------------------------------------------------------------------------------------------------------------------------
/**
* Format a phone number.
* <p>
* If the given number doesn‘t have the country code, the phone will be
* formatted to the default country‘s convention.
*
* @param phoneNumber
* the number to be formatted.
* @param defaultCountryIso
* the ISO 3166-1 two letters country code whose convention will
* be used if the given number doesn‘t have the country code.
* @return the formatted number, or null if the given number is not valid.
*
* @hide
*/
public static String formatNumber(String phoneNumber, String defaultCountryIso) {
// // Do not attempt to format numbers that start with a hash or star symbol.
// if (phoneNumber.startsWith("#") || phoneNumber.startsWith("*")) {
// return phoneNumber;
// }
// String result = null;
// try {
// PhoneNumber pn = util.parseAndKeepRawInput(phoneNumber, defaultCountryIso);
// result = util.formatInOriginalFormat(pn, defaultCountryIso);
// } catch (NumberParseException e) {
// }
// return result;
return phoneNumber; // Just return, don‘t format the phoneNumber
}
PATH: alps/packages/apps/contacts/src/com/mediatek/contacts/Simcontact
---------------------------------------------------------------------------------------------------------------------------
/*
* Bug Fix by Mediatek Begin. Original Android‘s code: xxx
* CR ID: ALPS00289127 Descriptions:
*/
Log.i(TAG, "[actuallyImportOneSimContact] phoneNumber before : " + phoneNumber);
// AsYouTypeFormatter mFormatter = PhoneNumberUtil.getInstance()
// .getAsYouTypeFormatter(countryCode);
// char[] cha = phoneNumber.toCharArray();
// int ii = cha.length;
// for (int num = 0; num < ii; num++) {
// phoneNumber = mFormatter.inputDigit(cha[num]);
// }
Log.i(TAG, "[actuallyImportOneSimContact] phoneNumber after : " + phoneNumber);
/*
* Bug Fix by Mediatek End.
*/
---------------------------------------------------------------------------------------------------------------------------
/*
* Bug Fix by Mediatek Begin. Original Android‘s code:
* xxx CR ID: ALPS00289127 Descriptions:
*/
Log.i(TAG, "[actuallyImportOneSimContact] additionalNumber before : "
+ additionalNumber);
// AsYouTypeFormatter mFormatter = PhoneNumberUtil.getInstance()
// .getAsYouTypeFormatter(countryCode);
// char[] cha = additionalNumber.toCharArray();
// int ii = cha.length;
// for (int num = 0; num < ii; num++) {
// additionalNumber = mFormatter.inputDigit(cha[num]);
// }
Log.i(TAG, "[actuallyImportOneSimContact] additionalNumber after : "
+ additionalNumber);
/*
* Bug Fix by Mediatek End.
*/
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。