Android中Telephony学习笔记(9)-Phone相关类
来源:互联网 发布:数学软件matlab下载 编辑:程序博客网 时间:2024/06/01 09:02
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)
监听信号强度改变的回调方法
0 0
- Android中Telephony学习笔记(9)-Phone相关类
- Android中Telephony学习笔记(6)-信号强度类
- Android中Telephony学习笔记(1)
- Android中Telephony学习笔记(4)-SmsMessage
- Android中Telephony学习笔记(7)-ServiceState
- Android telephony MMS 学习笔记
- Android telephony MMS 学习笔记
- Android telephony MMS 学习笔记
- Android telephony MMS 学习笔记
- Pro Android学习笔记(一二三):Telephony API(5):Phone
- Pro Android学习笔记(一二四):Telephony API(6):SIP Phone(上)
- Pro Android学习笔记(一二五):Telephony API(7):SIP Phone(下)
- Android中Telephony学习笔记(5)-CDMA/GSM/LTE/WCDMA
- Android中Telephony学习总结
- Android中的Telephony学习笔记(2)
- android中的telephony学习笔记(3)-SmsManager
- Android中的Telephony学习笔记(8)-NeighboringCellInfo
- Android Telephony相关
- 上传图片到服务器
- Eclipse Check for update 异常
- 如何使用搜索技巧来成为一名高效的程序员
- 过滤器 filter
- DIV+CSS圆角边框
- Android中Telephony学习笔记(9)-Phone相关类
- Java/android 里ClassName.this和this的使用
- 并发编程实践四:实现正确和高效的锁
- struts2小心使用chain跳转
- 最小花费
- test
- div ul li 嵌套后解决高度自适应方法
- plist
- 利用d3.js绘制中国地图