Recently made a login dialog box, in the acquisition of data errors, when running the automatic panic.
Error statement:
EditText Passwordeidttext = (EditText) Findviewbyid (R.id.userpasswordeidttext); Send text
String message =passwordeidttext.gettext (). toString ();
should be modified to:
EditText Passwordeidttext = (EditText) Dialogview. Findviewbyid (R.id.userpasswordeidttext); Send text
String message =passwordeidttext.gettext (). toString ();
Resources for Online Search:
Get a custom dialog box
Final View Dialogview = A. Inflate (R.layout.loand, NULL);
Create dialog box
Alertdialog dlg = new Alertdialog.builder (loand.this)
. Settitle ("Login Box")
. Setview (Dialogview)//Set the style of the custom dialog box
. Setpositivebutton ("Login",//Set "OK" button
New Dialoginterface.onclicklistener ()//Set event listener
{
public void OnClick (dialoginterface dialog, int whichbutton)
{
EditText1 = (EditText)Dialogview. Findviewbyid (R.ID.EDITTEXT1);
EditText2 = (EditText)Dialogview. Findviewbyid (R.ID.EDITTEXT2);
String id = edittext1.gettext (). toString ();
String password = Edittext2.gettext (). toString ();
When you are finished, click "OK" to start logging in
C_log judge = new C_log ();
Boolean B_judge = Judge.aa (Id,password);
if (B_judge) {
Bar ();
}else{
Add something
Displaytoast ("NO");
}
}
})
"Xfeng Android Development notes" Android How to get data from EditText in a dialog box