Note that there are some explanatory texts on larger screens.

plurals
  1. POWhile loop in zoom animate not executing?
    primarykey
    data
    text
    <p>I'm running a handler inside of a while loop, against a lat/lng span so if i'm outside of a certain span, that map will automatically zoomIn. I'm using this exact same setup, comparing zoom levels instead of spans and it works just fine. Here's what I'm doing...</p> <pre><code>public static void smoothZoomToSpan(final MapController controller, MapView v, GeoPoint center, int latitudeSpan, int longitudeSpan) { final Handler handler = new Handler(); final MapView mapView = v; final int currentLatitudeSpan = v.getLatitudeSpan(); final int currentLongitudeSpan = v.getLongitudeSpan(); final int targetLatitudeSpan = latitudeSpan; final int targetLongitudeSpan = longitudeSpan; controller.animateTo(center, new Runnable() { public void run() { int curLatSpan = currentLatitudeSpan; int curLngSpan = currentLongitudeSpan; int tarLatSpn = targetLatitudeSpan; int tarLngSpan = targetLongitudeSpan; long delay = 0; while ((curLatSpan - 6000 &gt; tarLatSpn) || (curLngSpan - 6000 &gt; tarLngSpan)) { Log.e("ZoomIn", "Thinks we should!"); handler.postDelayed(new Runnable() { @Override public void run() { controller.zoomIn(); Log.e("ZoomIn", "Zoomed"); } }, delay); delay += 150; // Change this to whatever is good on the // device } Log.e("ZoomIn", "completed"); } }); } </code></pre> <p>After I execute this code, Logcat outputs "Thinks we should!" (basically flooding the logs) endlessly. But it never does anything with my handler... the actual zoomIn call never fires, and it just loops forever until I force-close my application. What am I doing wrong?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload