开发者

How to create EditText field without click run intent?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜