1. android 文本支持超链接 android:autoLink,动态设置时在setOnKeyListener使用Linkify.addLinks。
2. android打电话:
加权限:android.permission.CALL_PHONE
Intent myIntentDial = new Intent("android.intent.action.CALL",Uri.parse("tel:"+strInput)); startActivity(myIntentDial);
3. android发短信:
加权限:android.permission.SEND_SMS
/*建构一取得default instance的 SmsManager对象 */ SmsManager smsManager = SmsManager.getDefault(); /*两个条件都检查通过的情况下,发送简讯 * * 先建构一PendingIntent对象并使用getBroadcast()方法进行Broadcast * * 将PendingIntent,电话,简讯文字等参数传入sendTextMessage()方法发送简讯*/ PendingIntent mPI = PendingIntent.getBroadcast(EX05_03.this, 0, new Intent(), 0); smsManager.sendTextMessage(strDestAddress, null, strMessage, mPI, null);字符超过数量(70个utf-16字符)拆分短信:SmsManager.divideMessage
<!-- 新增存取WIFI以及網路狀態等相關權限 --> <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"></uses-permission> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"></uses-permission> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission> <!-- 非必需 --> <uses-permission android:name="android.permission.INTERNET"></uses-permission> <uses-permission android:name="android.permission.WAKE_LOCK"></uses-permission>
(WifiManager) this.getSystemService(Context.WIFI_SERVICE)
5. 操作SIM卡:
TelephonyManager telManager = (TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);