课程登录密码

时间:2013-03-15 15:35:57

标签: android

这是登录设置的代码,以便进入设置页面。 onClickView显示错误,必须在Setting类中实现。有什么建议或解决方案吗?

public class Setting1 extends Settings  implements OnClickListener{

  public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.pass_set);
    EditText et = (EditText)findViewById(R.id.passwordedittext);
    Button buttonEnter = (Button)findViewById(R.id.sumbitbutton);
    buttonEnter.setOnClickListener(this);
  }

  @Override
  public void onCLick(View v){
    EditText et = (EditText)findViewById(R.id.passwordedittext);
    String password = et.getText().toString();
    et.getEditableText().toString();
    if(password.equals("Password")){
      Intent intent = new Intent(Setting1.this, Settings.class);
      startActivity(intent);
    }
    else{
      AlertDialog.Builder builder = new AlertDialog.Builder(this); 
      builder.setTitle("YOU SUCK!"); 
      builder.setMessage("Try Again!"); 
      builder.setPositiveButton("OK", null); 
      AlertDialog dialog = builder.show();
    }
  }
}

1 个答案:

答案 0 :(得分:0)

正如 @ A - C 已在评论中指出,

public void onClick(View v){
.
.
.    
    }

您错误拼写 onClick (您的代码 onCLick )。