public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mobileEditText = (EditText) this.findViewById(R.id.app_name);
mobileButton = (Button) this.findViewById(R.id.button);
mobileButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
String mobile = mobileEditText.getText().toString();
Intent intent = new Intent(Intent.ACTION_CALL,Uri.parse("tel:"+mobile));
androidTest2Activity.this.startActivity(intent);
}
});
}
--------------------------------------------------------------------------------------
public void onClick(View v) {
// TODO Auto-generated method stub
String mobile = mobileText.getText().toString();
String content = contentText.getText().toString();
SmsManager smsManager = SmsManager.getDefault();
if(content.length()>70){
List<String> contents=smsManager.divideMessage(content);
for(String sms:contents){
smsManager.sendTextMessage(mobile, null, sms, null, null);
}
}
else{
smsManager.sendTextMessage(mobile, null, content, null, null);
}
Toast.makeText(SMSActivity.this, "发送成功", 2).show();
}
//本文出自 “阿凡达” 博客,请务必保留此出处http://shamrock.blog.51cto.com/2079212/702527