I have an android app which calls upon a php script, the php script simply does this: echo "1" if true, echo "2" if false.
The android app buffers the script using:
InputStream inputStream = httpURLConnection.getInputStream();
BufferedReader bufferedReader = new BufferedReader(new
InputStreamReader(inputStream, "iso-8859-1"));
while ((line = bufferedReader.readLine()) != null) {
result += (line);
}
The problem I am having is that, my android app then compares the variable result with if(result == "1")
But for some reason, the comparison always goes to the "else" and never hits the "if"
I have made sure my PHP script echos just "1", also made an alertdialog box to confirm that "1" is being returned to the variable "result"
Is it because of my inputstream? I am quite stumpped at the moment
EDIT: Also want to affirm that this is not a duplicate question to "how do you compare strings in java." My question is regarding comparing a PHP echo output, to Java's inputstream.