android短信发送器,简易版
一.画界面等跟拨号器是同个道理
二.注册权限
<uses-permission android:name="android.permission.SEND_SMS"/>
三.activity类代码
Java代码
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
number = (EditText) this.findViewById(R.id.number_edit);
content = (EditText) this.findViewById(R.id.content_edit);
Button button = (Button) this.findViewById(R.id.send_button);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String numberStr = number.getText().toString();
String contentStr = content.getText().toString();
SmsManager smsManager = SmsManager.getDefault();
ArrayList<String> texts = smsManager.divideMessage(contentStr);
for(String text : texts){
smsManager.sendTextMessage(numberStr, null, text, null, null);
}
Toast.makeText(MessageActivity.this, R.string.success, Toast.LENGTH_LONG).show();
}
});
}
作者“XiaOpieR”
补充:移动开发 , Android ,