Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的
创建
我在设置
myString = getIntent().getStringExtra("sentString");
在那之后
if (myString == "test") {...}
执行失败...
即使之后
btnTest.setText(myString);
作品
问题是什么?
比较字符串时始终使用 String.equals()。== 只会比较参考。
示例:代替
采用:
if (myString.equals("test")) {...}