Can any please find out what is the mistake I am doing here…
The value in str is printing true everywhere but still it goes to else..
Thanks in Advance
String str = inputStreamToString(response.getEntity().getContent()).toString();
Log.w("gotit signup response from web", str);
if(str.toString().equalsIgnoreCase("true"))
{
// GO TO HOMEPAGE
Intent j = new Intent();
j.setClassName("com.test.babynames", "com.test.babynames.Home");
startActivity(j);
}else
{
Log.w("gotit Signup .... ",str);
Log.w("gotit Signup .... ", "FALSE");
result.setText(str);
}
Probably because it contains a space or another invisible character. Try printing it enclosed in delimiters, and/or use the
trim()method to remove whitespace chars at the beginning and the end of the string.If this still doesn’t work, print the numeric value of every character of the string, and do the same with “true”, to detect where they differ:
And calling toString() on a String doesn’t make any sense, as said in the comments. The String class overrides
Object.toString()to return itself.