My piece of code is
String gps = "gps";
if (loc.getProvider() == gps){
forCampaignCopy.setText(loc.getProvider());
locationManager.removeUpdates(locationListener); //to stop using the sensor
}
else{
forCampaignCopy.setText(loc.getProvider());
}
When I run the debugger, it stops at the if statement and I can see that loc.getProvider() says gps (since that is the provider im using), however it then jumps to the else statement but prints out "gps". Why is this happening?