I am currently trying to handle what happens with results if there is input received and coming across some troubles, I want to be able to set the text to a specific phrase if there is no result, and want to be able to have the input show correctly if there is. I am currently trying this:
String s = scanningResult.getContents();
if (s == null){
s="Location Is here,Time is here,Cost is here";
}
else {
s=s;
}
String [] s2 = s.split(",");
TextView location = (TextView)findViewById(R.id.LocationResult);
location.setText(s2[0]);
TextView time = (TextView)findViewById(R.id.TimeResult);
if (s2[1] == "Time is here"){
time.setText("Time is here");
}
else {
time.setText(s2[1]+" Seconds");
}
TextView cost = (TextView)findViewById(R.id.CostResult);
if (s2[2] == "Cost is here"){
cost.setText("Cost is here");
}
else {
cost.setText("$"+s2[2]);
}
}
The problem i am having is that on a null scanningResult
the two values time
and cost
will come out as Time is here Seconds
and $Cost is here
. And i don't see why.