title: onProviderDisabled - differentiating the provider
body: <pre><code>public void getCurrentLocation(){
  
   final LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
  
       LocationListener locationListener = new LocationListener() {
          public void onLocationChanged(Location location) {
           //
          }
  
          public void onStatusChanged(String provider, int status, Bundle extras) {
  
          }
  
          public void onProviderEnabled(String provider) {}
  
          public void onProviderDisabled(String provider) {
              if(provider=="gps"){
              Toast.makeText(getApplicationContext(), "GPS is off", Toast.LENGTH_LONG).show();
  
              startActivity(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS));
              }
              Log.i("lm_disabled",provider);
          }
        };
  
    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,0, locationListener);
    locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,0,0, locationListener);
  }
  </code></pre>
  
  <p>This seems like a legit code. However, the if expression never runs. I have debugged my application, the provider is "gps", it is string type - but the if returns false, I guess...</p>
  
  <p>What am I missing here?</p>