- 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();
- }