Simple SMS sender ISMs

Source: Internet
Author: User

This is a simple text message sender developed by elder brother.

Attached source code:

 
 
  1. <? XML version = "1.0" encoding = "UTF-8"?>
  2. <Linearlayout xmlns: Android = "http://schemas.android.com/apk/res/android"
  3. Android: Orientation = "vertical"
  4. Android: layout_width = "fill_parent"
  5. Android: layout_height = "fill_parent"
  6. >
  7.  
  8. <Textview
  9. Android: text = "@ string/moble"
  10. Android: layout_width = "fill_parent"
  11. Android: layout_height = "wrap_content"
  12. />
  13. <Edittext
  14. Android: Id = "@ + ID/mobile"
  15. Android: layout_width = "fill_parent"
  16. Android: layout_height = "wrap_content"/>
  17. <Textview
  18. Android: text = "@ string/content"
  19. Android: layout_width = "fill_parent"
  20. Android: layout_height = "wrap_content"
  21. />
  22. <Edittext
  23. Android: Id = "@ + ID/content"
  24. Android: layout_width = "fill_parent"
  25. Android: layout_height = "wrap_content"
  26. Android: minlines = "5"/>
  27. <Button
  28. Android: Id = "@ + ID/Send"
  29. Android: text = "@ string/Send"
  30. Android: layout_width = "fill_parent"
  31. Android: layout_height = "wrap_content"
  32. > </Button>
  33. </Linearlayout>
 
 
  1. Package gphone. CC. ISMs;
  2.  
  3. Import Android. App. activity;
  4. Import Android. OS. Bundle;
  5. Import Android. telephony. smsmanager;
  6. Import Android. View. view;
  7. Import Android. widget. Button;
  8. Import Android. widget. edittext;
  9. Import Android. widget. Toast;
  10.  
  11. Import java. util. arraylist;
  12.  
  13. Public class ismsactivity extends Activity
  14. {
  15. Edittext mobile = NULL;
  16. Edittext content = NULL;
  17. Button sent = NULL;
  18. /** Called when the activity is first created .*/
  19. @ Override
  20. Public void oncreate (bundle savedinstancestate)
  21. {
  22. Super. oncreate (savedinstancestate );
  23. Setcontentview (R. layout. Main );
  24.  
  25.  
  26.  
  27. Sent = (button) This. findviewbyid (R. Id. Send );
  28. Sent. setonclicklistener (New button. onclicklistener (){
  29. Public void onclick (view ){
  30. Mobile = (edittext) findviewbyid (R. Id. Mobile );
  31. String mobilestr = Mobile. gettext (). tostring ();
  32. Content = (edittext) findviewbyid (R. Id. content );
  33. String contentstr = content. gettext (). tostring ();
  34.  
  35. Smsmanager = smsmanager. getdefault ();
  36.  
  37. If (contentstr. Length ()> 70 ){
  38. Arraylist <string> contents = smsmanager. dividemessage (contentstr );
  39. For (string SMS: Contents ){
  40. Smsmanager. sendtextmessage (mobilestr, null, contentstr, null, null );
  41. }
  42. }
  43. Else {
  44. Smsmanager. sendtextmessage (mobilestr, null, contentstr, null, null );
  45.  
  46. }
  47. Toast. maketext (ismsactivity. This, R. String. MSG, Toast. length_long). Show ();
  48.  
  49. }
  50. });
  51.  
  52.  
  53. }
  54. }

Androidminifast. xml

 
 
  1. <? XML version = "1.0" encoding = "UTF-8"?>
  2. <Manifest xmlns: Android = "http://schemas.android.com/apk/res/android"
  3. Package = "gphone. CC. isms"
  4. Android: versioncode = "2"
  5. Android: versionname = "1.1" type = "codeph" text = "/codeph">
  6. <Application Android: Label = "@ string/app_name" Android: icon = "@ drawable/icon">
  7. <Activity Android: Name = "ismsactivity"
  8. Android: Label = "@ string/app_name">
  9. <Intent-filter>
  10. <Action Android: Name = "android. Intent. Action. Main"/>
  11. <Category Android: Name = "android. Intent. Category. launcher"/>
  12. </Intent-filter>
  13. </Activity>
  14. </Application>
  15. <Uses-SDK Android: minsdkversion = "3"/>
  16. <Uses-Permission Android: Name = "android. Permission. send_sms"/>
  17.  
  18. </Manifest>

String. xml

 
  
  
  1. <? XML version = "1.0" encoding = "UTF-8"?>
  2. <Resources>
  3. <String name = "app_name"> ISMs </string>
  4. <String name = "moble"> enter the phone number </string>
  5. <String name = "content"> enter the text message content </string>
  6. <String name = "send"> send SMS </string>
  7. <String name = "MSG"> sms sent </string>
  8. </Resources>

: ISMs (Change RAR to APK)

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.