I. Drawing the interface is the same as the dial.
Ii. Registration permission
<Uses-permission android: name = "android. permission. SEND_SMS"/>
Iii. activity Code
Java code
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 ();
}
});
}
Author: "XiaOpieR"