Code example for LatLng

0
        Location location = ((LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE)).getLastKnownLocation("gps");
        return locationToLatLng(location);
    } 
 
    private LatLng locationToLatLng(Location location) {
        return new LatLng(location.getLatitude(), location.getLongitude());
    } 
 
} 
Connect your IDE to all the code out there  Get Codota for Java