標籤:android style blog class code tar
1 調用傳送簡訊功能:
Uri smsToUri = Uri.parse("smsto:"); Intent sendIntent = new Intent(Intent.ACTION_VIEW, smsToUri); sendIntent.putExtra("address", "123456"); //電話號碼,這行去掉的話,預設就沒有電話sendIntent.putExtra("sms_body","簡訊內容"); sendIntent.setType("vnd.android-dir/mms-sms"); startActivity(sendIntent); 2 調用發送郵件功能: Intent email = new Intent(android.content.Intent.ACTION_SEND);email.setType("plain/text");String[] emailReciver = new String[]{"[email protected]","[email protected]"}; String emailSubject = "從問道分享來的文章";StringemailBody = internetpath;//設定郵件預設地址email.putExtra(android.content.Intent.EXTRA_EMAIL, emailReciver);//設定郵件預設標題email.putExtra(android.content.Intent.EXTRA_SUBJECT, emailSubject);//設定要預設發送的內容email.putExtra(android.content.Intent.EXTRA_TEXT, emailBody);//調用系統的郵件系統startActivity(Intent.createChooser(email, "請選擇郵件發送軟體")); 3.打電話 Intent intent = new Intent();
intent.setAction("android.intent.action.DIAL");
intent.setData(Uri.parse("tel:400 616 0066"));
startActivity(intent);
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.SEND_SMS"/>