public void onMyButtonClick1(View view)
{
final EditText emailValidate = (EditText)findViewById(R.id.emailid);
final TextView passValidate = (TextView)findViewById(R.id.password);
String email = emailValidate.getText().toString().trim();
String pass= passValidate.getText().toString().trim();
String emailPattern = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+";
// onClick of button perform this simplest code.
if (email.matches(emailPattern)&&(passValidate!=null))
{
//Toast.makeText(this,"valid email address",Toast.LENGTH_SHORT).show();
Toast.makeText(this, "Welcome To Sun Telematics", Toast.LENGTH_SHORT).show();
Intent getStarted = new Intent(getApplicationContext(), FourthActivity.class);
startActivity(getStarted);
/*else
{
Toast.makeText(this, "Field Required", Toast.LENGTH_SHORT).show();
}*/
}
else
{
Toast.makeText(getApplicationContext(),"Invalid email address", Toast.LENGTH_SHORT).show();
}
}
我想检查密码字段是否为空。如果它是空的,它将不会进入下一个活动。它将显示吐司消息。我可以验证该字段。我在哪里可以对代码进行更改。