I'm creating a password field. I want to input password and at once star new intent. Her is my code:
EditText passwd = (EditText) findViewById(R.id.passwd);
passwd.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
EditText ryt = (EditText) findViewById(R.id.editPasswd);
if(ryt.getText().toString().equals("123")) {
Intent intent = new Intent(first.this, second.开发者_如何转开发class);
startActivity(intent);
System.exit(0);
}
}
}
I wondering how to change onClick method. Maybe some one had similar problem. Thanks in advance
final EditText passwd = (EditText) findViewById(R.id.passwd);
Witha final variable you would be able to access it from your inner class.
Erasing System.exit(0)
might be a good start.
精彩评论