1
主题类如下
SmsManager manager = SmsManager.getDefault();
EditText textSms = (EditText)MainActivity.this.findViewById(R.id.smsContent);
EditText mobileNumber = (EditText)MainActivity.this.findViewById(R.id.smsPhone);
List<String> texts = manager.divideMessage(textSms.getText().toString());
//此处不要用循环
// for (String txt : texts) {
// System.out.println(txt+mobileNumber.getText().toString());
// }
manager.sendTextMessage(mobileNumber.getText().toString(), null, textSms.getText().toString(), null, null);
Toast.makeText(MainActivity.this, "发送完成", Toast.LENGTH_LONG);
return;
2 打电话关键代码
Intent intent = new Intent(Intent.ACTION_CALL,Uri.parse("tel:"+number));
startActivity(intent);
3
分别添加如下两个权限在主配置文件中
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.SEND_SMS"/>