我有问题,Android的价值,如果不工作
final Button button = (Button) findViewById(R.id.okBtn);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
String res = getServerData("http://10.0.2.2/auth.php?username="+username.getText()+"&password="+password.getText());
//txt.setText(res);
if("true".equals(res))
txt.setText("SUCESS");
else
txt.setText("FAILED");
}
});
为什么这种情况继续失败,即使如果我取消txt.setText(RES),它显示为真。任何想法为什么?
谢谢。
我最好的建议是进入调试模式,检查是否通过了res和res的确切内容。在我看来,它没有通过if,否则textview应该显示SUCCESS,因为它已被正确初始化(显然如此,因为如果您取消注释该注释行,它会显示为真)。 – asenovm 2011-04-24 15:02:53