Forum Xamarin.Android

setLatitude() error CS1061

Hi All,

Trying to get distanceTo from current location to any point using setLatitude and setLongitude.
I get the following error: Error CS1061: Type 'Android.Locations.Location' does not contain a definition for 'setLatitude' and no extension method 'setLatitude' of 'typeAndroid.Locations.Location' could be found. Are you missing an assembly reference? (CS1061)

This is what I have in the mainactivity:
public class MainActivity : Activity, ILocationListener
Location _currentLocation, locationA, _dest;
public double dest_Latitude = 0.0;
public double dest_Longitude = 0.0;
public void OnLocationChanged(Location location)

                _currentLocation = location;
                if (_currentLocation == null)
                  _locationText.Text = "Unable to determine your location.";
                                  locationA = _currentLocation;
                  dest_Latitude = -58.381558;
                  dest_Longitude = -34.60508;
                  _dest.setLatitude( dest_Latitude);
                   ... some other code here..

The error shows when building the app and is related to the line: _dest.setLatitude( dest_Latitude);

What could be the issue with setLatitude method?.
I'm newbie in mobile programming and C# programming.
Thanks in advance.


Sign In or Register to comment.