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