MapController, OSMdroid, zoomToSpan () freezes the application

I am using OSMdroid to display an offline map. MapView is inside the fragment. I would like to enlarge the map to cover two points (top_left, bottom_right). Currently, when I call zoomToSpan () on onViewCreated (), the application freezes. I tried using BoundingBoxE6 and latitude, longitude, but nothing has changed.

BoundingBoxE6 bb = new BoundingBoxE6( LocationConstants.TOP_LEFT_LATITUDE, LocationConstants.TOP_LEFT_LONGITUDE, LocationConstants.BOTTOM_RIGHT_LATITUDE, LocationConstants.BOTTOM_RIGHT_LONGITUDE); 

or

  int latitudeSpan = (int) Math.abs(LocationConstants.TOP_LEFT_LATITUDE*1E6 - LocationConstants.BOTTOM_RIGHT_LATITUDE*1E6); int longitudeSpan = (int) Math.abs(LocationConstants.TOP_LEFT_LONGITUDE*1E6 - LocationConstants.BOTTOM_RIGHT_LONGITUDE*1E6); 

give the same results.

+4
source share

Source: https://habr.com/ru/post/1492916/


All Articles