Android中Telephony学习笔记(9)-Phone相关类
2014-05-10 13:14
375 查看
PhoneNumberUtils
提供多种方法工具处理电话号码字符串,工具类。Constants
FORMAT_JAPAN:日本区号列表
FORMAT_NANP:北美洲电话区号列表
FORMAT_UNKNOWN:未知地区
PAUSE
TOA_International
TOA_Unknown
WAIT
WILD
Methods
public static String calledPartyBCDFragmentToString(byte[] bytes, int offset, int length)
public static String calledPartyBCDToString(byte[] bytes, int offset, int length)
public static boolean compare(String a, String b)
public static boolean compare(Context context, String a, String b)
public static String convertKeypadLettersToDigits(String input)
public static String extractNetworkPortion(String phoneNumber)
public static String extractPostDialPortion(String phoneNumber)
public static void formatJapaneseNumber(Editable text)
public static void formatNanpNumber(Editable text)
public static String formatNumber(String source)
public static void formatNumber(Editable text, int defaultFormattingType)
public static int getFormatTypeForLocale(Locale locale)
public static String getNumberFromIntent(Intent intent, Context context)
public static String getStrippedReversed(String phoneNumber)
public static final boolean
isDialable (char c)
public static boolean isEmergencyNumber(String number)
public static boolean isGlobalPhoneNumber(String phoneNumber)
public static boolean isISODigit(char c)
public static final boolean
isNonSeparator (char c)
public static final boolean
isReallyDialable (char c)
public static final boolean
isStartsPostDial (char c)
public static boolean isWellFormedSmsAddress(String address)
public static byte[] networkPortionToCalledPartyBCD(String s)
public static byte[] networkPortionToCalledPartyBCDWithLength(String s)
public static byte[] numberToCalledPartyBCD(String number)
public static String stringFromStringAndTOA(String s, int TOA)
public static String stripSeparators(String phoneNumber)
public static String toCallerIDMinMatch(String phoneNumber)
public static int toaFromString(String s)
对字符串各种操作,提取到所需要的信息。不做具体解释了。PhoneNumberFormattingTextWatcher
观察TextView和输入手机号码时,该类提供监听,严格规范手机号码的格式。当用户输入无效的字符,或者删除字符串中间的分隔符该格式化watcher就停止工作。Methods
public synchronized void afterTextChanged(Editable s)
改变后调用该方法,在Editable内部中,当text文本值改变后是调用该回调public void beforeTextChanged(CharSequence s, int start, int count, int after)
该回调方法会在改变之前通知你charSequence对象会在第start位置用after长度的字符序列替换当前对象的count个数的字符public void onTextChanged(CharSequence s, int start, int before, int count)
改变中调用该回调方PhoneStateListener
监听类,监听手机状态的改变。信号强度,语音信息等。通过TelephonyManager.Listen()给手机添加该监听器。Constants
LISTEN_CALL_FORWARDING_INDICATOR:呼叫转移的状态改变
LISTEN_CALL_STATE:通话状态的改变
LISTEN_CELL_INFO:信元信息的改变
LISTEN_CELL_LOCATION:信元位置的改变,每隔一段时间返回一次。
LISTEN_DATA_ACTIVITY:数据连接中数据流量的方位改变
LISTEN_DATA_CONNECTION_STATE:数据连接状态的改变
LISTEN_MESSAGE_WAITING_INDICATOR:信息等待显示的改变
LISTEN_NONE:停止监听器的更新
LISTEN_SERVICE_STATE:网络服务状态的改变
LISTEN_SIGNAL_STRENGTH:废弃
LISTEN_SIGNAL_STRENGTHS:网络信号强度的改变
Methods
public void onCallForwardingIndicatorChanged(boolean cfi)
呼叫转移状态改变的回调方法public void onCallStateChanged(int state, String incomingNumber)
监听通话状态的改变的回调方法public void onCellInfoChanged(List<CellInfo> cellInfo)
监听信元信息改变的回调方法public void onCellLocationChanged(CellLocation location)
监听设备位置信息改变的回调方法public void onDataActivity(int direction)
监听数据活动状态改变的回调方法public void onDataConnectionStateChanged(int state)
监听数据连接状态改变的回调方法public void onDataConnectionStateChanged(int state, int networkType)
同上,但是还监听网络类型的改变public void onMessageWaitingIndicatorChanged(boolean mwi)
监听信息等待显示信息改变的回调方法public void onServiceStateChanged(ServiceState serviceState)
监听设备服务状态改变的回调方法public void onSignalStrengthChanged(int asu)
已废弃public void onSignalStrengthsChanged(SignalStrength signalStrength)
监听信号强度改变的回调方法相关文章推荐
- android导航栏相关控件使用学习笔记
- android 学习笔记(五)调试相关 5.4 常用adb命令详表
- android 学习笔记(五) 调试相关 5.1 android使用wifi进行程序调试
- android 学习笔记(五) 调试相关 5.2 在android真机中建一个ssh服务器
- android 学习笔记(五)调试相关 5.3 在android获取root权限
- (学习笔记) Android Activity相关
- Android中的Telephony学习笔记(2)
- PhoneGap学习笔记-----phone3.4之Android搭建
- Android中的Telephony学习笔记(8)-NeighboringCellInfo
- Android adb命令学习笔记(一)——adb介绍以及关于传输文件等相关基本命令
- Android telephony MMS 学习笔记
- Android中的Telephony学习笔记(2)
- android 相关学习笔记
- 学习android 笔记(4):如何获取屏幕的相关属性以及dp 、dip、dpi 、px的概念
- android 学习笔记(五)调试相关 5.5 eclipse中ndk环境
- Android中Telephony学习笔记(5)-CDMA/GSM/LTE/WCDMA
- Android中Telephony学习笔记(6)-信号强度类
- (学习笔记) Android Intent相关
- Android中Telephony学习笔记(1)
- PhoneGap学习笔记-----phone3.4之Android搭建--导出jar包(处处可用)--并导出插件或加入第三方插件