EditText txtUserName;
EditText txtPassword;
Button btnLogin;
Button btnCancel;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
txtUserName=(EditText)this.findViewById(R.id.txtUname);
txtPassword=(EditText)this.findViewById(R.id.txtPwd);
btnLogin=(Button)this.findViewById(R.id.btnLogin);
Button btnLogin=(Button)this.findViewById(R.id.Button01);
btnLogin.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if((txtUserName.getText().toString()).equals(txtPassword.getText().toString())){
Toast.makeText(LoginappActivity.this, "Login Successful",Toast.LENGTH_LONG).show();
} else{
Toast.makeText(LoginappActivity.this, "Invalid Login",Toast.LENGTH_LONG).show();
}
}
});
Button next = (Button) findViewById(R.id.Button01);
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), AddName.class);
startActivityForResult(myIntent, 0);
}});
}
}
在模拟器上运行此应用程序时,它运行良好,没有任何错误,但没有显示任何用户名和密码已成功记录或登录无效的消息,但是当我单击下一步按钮时,将显示下一个屏幕