0

这是登录设置的代码,以便进入设置页面。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();
    }
  }
}
4

1 回答 1

0

正如@A--C已经在评论中指出的那样,

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

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

于 2013-03-15T16:50:38.687 回答