Package android.m9; Import Android.app.activity;import android.os.bundle;import Android.view.menu;import Android.view.MenuItem;import Android.view.view;import Android.view.view.onclicklistener;import Android.widget.button;import Android.widget.edittext;import Android.widget.TextView; public class HelloWorld extends Activity {private TextView logo;private EditText et;private Button Reset, submit;private EditText result;private String name;private String LastName = "";private int rp;/** Called when the activity is first created. * /@OverridePublic void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate);Setcontentview (r.layout.main); // ///////////////////////////////////////////////Logo setlogo = (TextView) Findviewbyid (r.id.textview_1);Logo.settext (R.string.logo); // //////////////////////////////////////////////EditText setet = (EditText) Findviewbyid (r.id.edittext_1);Et.settext (r.string.inputtip); // //////////////////////////////////////////////Button Set:resetreset = (Button) Findviewbyid (r.id.button_1);Reset.settext (r.string.reset);Reset.setonclicklistener (New Onclicklistener () {Public void OnClick (View v) {Et.settext (r.string.inputtip);Result.settext (""); } });//button Set:resetsubmit = (Button) Findviewbyid (r.id.burron_2);Submit.settext (r.string.submit);Submit.setonclicklistener (New Onclicklistener () {Public void OnClick (View v) {name = Et.gettext (). toString ();if (!lastname.equals (name)) {RP = (int) (Math.random () *);Result.settext ("Tester name:" + name + "\ n" + "character score:" + RP);lastName = name;http://www.huiyi8.com/webyuanma/} else {Website source code Downloadresult.settext ("Please replace the tester!\n\n the name of the tester:" + name + "\ n" )+ "character score:" + RP); } } }); // //////////////////////////////////////////////TextView setresult = (EditText) Findviewbyid (r.id.edittext_2);result.setenabled (false);Result.settextcolor (Android.graphics.Color.BLUE); }@OverridePublic Boolean Oncreateoptionsmenu (Menu menu) {menu.add (0, 1, 1, r.string.exit);return Super.oncreateoptionsmenu (menu); }@OverridePublic Boolean onoptionsitemselected (MenuItem item) {if (item.getitemid () = = 1) {finish (); }return super.onoptionsitemselected (item); }}