开发者

How to create EditText field without click run intent?

开发者 https://www.devze.com 2023-02-07 04:24 出处:网络
I\'m creating a password field. I want to input password and at once star new intent. Her is my code:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消