I am currently creating an app which uses location based variables and for arguments sake, I want to take in the string which is assigned from getThoroughfare()
and afaik, it's a String according to the API but lets say I do this
class Game extends MapActivity{
public random function(){
if(addresses!= null){
Address address = addresses.get(0);
this.locationText.append("\n" + address.getThoroughfare() + ", " + address.getLocality());
userLoc = address.getThoroughfare();
System.out.println(userLoc);
}
}
This works and will print out the name of the Street but within another class, if I check it like
if(Game.userLoc == myStreetString){
//do stuff
}
it will not work, let I have insured the strings matched, what gives? Any help would be great
You should use equals instead of == for comparing strings.
if(Game.userLoc.equals(myStreetString)){