Android Note day3

Source: Internet
Author: User

SMS Transmitter

The computer is weak, open a second emulater to 10min!!!

Learn to view API documentation by the way

1  Packagecom.example.a11;2 3 ImportJava.util.*;4 5 Importandroid.app.Activity;6 ImportAndroid.os.Bundle;7 ImportAndroid.telephony.SmsManager;8 ImportAndroid.view.Menu;9 ImportAndroid.view.MenuItem;Ten ImportAndroid.view.View; One Importandroid.widget.*; A Importandroid.view.*; -  -  Public classMainactivityextendsActivity { the  -      -     PrivateEditText Numbertext; -     PrivateEditText ContentText; + @Override -     protected voidonCreate (Bundle savedinstancestate) { +         Super. OnCreate (savedinstancestate); A Setcontentview (r.layout.activity_main); at          -numbertext= (EditText) This. Findviewbyid (R.ID.EDITTEXT2); -contenttext= (EditText) This. Findviewbyid (R.ID.EDITTEXT1); -          -Button button= (button) This. Findviewbyid (R.id.button); -Button.setonclicklistener (NewButtonclicklistener ()); in          -          to     } +      -     Private Final classButtonclicklistenerImplementsView.onclicklistener { the @Override *          Public voidOnClick (View v) { $             //TODO auto-generated Method StubPanax NotoginsengString number=Numbertext.gettext (). toString (); -String content=Contenttext.gettext (). toString (); the              +Smsmanager manager=Smsmanager.getdefault (); AArraylist<string> texts=manager.dividemessage (content); the              for(String text:texts) { +Manager.sendtextmessage (number,NULL, text,NULL,NULL); -             } $              $Toast.maketext (mainactivity. This, R.string.success, Toast.length_long). Show (); -         } -     } the  - @OverrideWuyi      Public BooleanOncreateoptionsmenu (Menu menu) { the         //inflate the menu; This adds items to the action bar if it is present. - getmenuinflater (). Inflate (R.menu.main, menu); Wu         return true; -     } About  $ @Override -      Public Booleanonoptionsitemselected (MenuItem item) { -         //Handle Action Bar item clicks here. The Action Bar would -         //automatically handle clicks on the Home/up button, so long A         //As you specify a the parent activity in Androidmanifest.xml. +         intID =Item.getitemid (); the         if(id = =r.id.action_settings) { -             return true; $         } the         return Super. onoptionsitemselected (item); the     } the      the      -      in      the      the      About      the      the}
View Code

Android Note day3

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.