Fix float format

This commit is contained in:
Victor Shcherb 2020-09-10 11:37:36 +02:00
parent 1b85b5a732
commit c914e18fc1

View file

@ -51,11 +51,11 @@ public class OsmAndHttpServer extends NanoHTTPD {
public String getUrl() { public String getUrl() {
RotatedTileBox rtb = mapActivity.getMapView().getCurrentRotatedTileBox(); RotatedTileBox rtb = mapActivity.getMapView().getCurrentRotatedTileBox();
double lat = rtb.getLatitude(); float lat = (float) rtb.getLatitude();
double lon = rtb.getLongitude(); float lon = (float) rtb.getLongitude();
double z = rtb.getZoom(); int z = rtb.getZoom();
return "http://" + getHostname() + ":" + getListeningPort() return String.format("http://%s:%d/?lat=%.4f&lon%.4f&zoom=%d", getHostname(), getListeningPort(),
+ "/?lat=" + lat + "&lon=" + lon + "&zoom=" + z; lat, lon, z);
} }
private NanoHTTPD.Response routeApi(NanoHTTPD.IHTTPSession session) { private NanoHTTPD.Response routeApi(NanoHTTPD.IHTTPSession session) {