Android text message sender, simple Edition

Source: Internet
Author: User

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"
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.