onlylemi / MapView

A MapView on Android platform.
MIT License
678 stars 162 forks source link

MapView.setCurrentZoom(float zoom) working on Debug Mode but not on Run Mode #11

Open MrAlaboheme opened 8 years ago

MrAlaboheme commented 8 years ago

Hi,

I copied the code used for the routeLayerActivity but my map is too big for the screen so it is too tiny. I decided to set a zoom in the OnCreate of the activity.

PointF target = null;
if(item.getItemMark() != null){
     target = new PointF(item.getItemMark().x, item.getItemMark().y);
     routeList = MapUtils.getShortestDistanceBetweenTwoPoints(marks.get(0), target, nodes, nodesContract);
     routeLayer.setNodeList(nodes);
     routeLayer.setRouteList(routeList);
     mapView.refresh();
}

mapView.setCurrentZoom(mapView.getCurrentZoom() * 4, 0, 300);
mapView.refresh();

On debug mode if I suspend the thread from my var target, the zoom method will be apply to the map but if I don't suspend the thread or I launch the activity with the run session zoom won't be apply.

Any idea ?