@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);
btnLogin=(Button)this.findViewById(R.id.btnLogin);
btnLogin.setOnClickListener(new OnClickListener() {
Button next = (Button) findViewById(R.id.Button01);
error1: next.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), AddName.class);
startActivityForResult(myIntent, 0);
}}
error2: )
};
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();
}
}
}
我创建了一个登录应用程序来从一个意图更改为另一个意图。另一个 .java 工作正常
error1:令牌上的语法错误,应改为 AnnotationName
error2: 此行有多个标记
-Syntax error, insert "EnumBody" to complete EnumDeclaration
-Syntax error, insert "enum Identifier" to complete EnumHeaderName
-Syntax error, insert ")" to complete Expression
-Syntax error, insert "}" to complete ClassBody