简体   繁体   English

Android希伯来语EditText

[英]Android Hebrew EditText

Im working on hebrew logo quiz app and i need to use an edittext that the user type what he see and then compare it to the preset value. 我正在使用希伯来语徽标测验应用程序,我需要使用edittext,用户键入他所看到的内容,然后将其与预设值进行比较。 The current code is 当前代码是

        Check.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String word = String.valueOf(test.getText());
            String word2 = String.valueOf("טקסט בעברית");
            if (word==word2){
                tv.setText("True");
            }
            else tv.setText("False");
        }

    });

and the output is always False as well as the correct answer.. I really need help here 并且输出始终为False以及正确答案..我真的需要这里的帮助

you are comparing two object by their references and because they are not same, returned value is always false. 您正在通过引用比较两个对象,并且由于它们的引用不同,因此返回值始终为false。 you should compare their values not their reference. 您应该比较它们的值而不是它们的参考。 read more here 在这里阅读更多

String class in java has a method for comparison. Java中的String类有一个比较方法。 you should use equals method. 您应该使用equals方法。 read more here 在这里阅读更多

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM