Search code examples
androidlocationgeopoints

GeoPoint and current Location


how I can get current GeoPoint from my location. I am on : Longitude: 21.760029 Latitude: 54.035795

But when I use getLatitude(), I have 54.0 but I want 54.035795.


Solution

  • Here's a method for converting a latitude, longitude pair to a GeoPoint object:

    public static GeoPoint convert(double latitude, double longitude)
    {
        int lat = (int)(latitude * 1E6);
        int lng = (int)(longitude * 1E6);
    
        return new GeoPoint(lat, lng);
    }