Android 为什么可以';难道它不能穿过绳子,敬酒吗?它总是成真的

Android 为什么可以';难道它不能穿过绳子,敬酒吗?它总是成真的,android,Android,//所以,如果在字符串中找到“hi+”,它将显示true String hint = chatText.getText().toString(); String text = "hi+"; Boolean found; found = text.contains(hint); //如果它是假的,它会把我带到这里 if(found==true){ Toast.makeText(getApplicationContext(), "BoomSh

//所以,如果在字符串中找到“hi+”,它将显示true

    String hint = chatText.getText().toString();
    String text = "hi+";
    Boolean found;
    found = text.contains(hint);
//如果它是假的,它会把我带到这里

    if(found==true){
        Toast.makeText(getApplicationContext(), "BoomShakalaka",
                Toast.LENGTH_SHORT).show();

    }

它应该是另一种方式,因为您想要检查字符串(提示)是否包含“hi+”

如果像这样的
found==true
没有必要,为什么要使用

found = hint.contains(text);

你能调试你的应用程序并找出
hint
的内容吗?顺便说一句,你的字符串hint=“hi+”初始化错误;和字符串text=chatText.getText().toString();您的代码将很好地工作,否则,如果您不想更改变量checkout,我将给出答案
found = hint.contains(text);
//make your if statement like this 
if(found){
    //Do something when found is true
}else{
    //DO something when found is false
 }