Note that there are some explanatory texts on larger screens.

plurals
  1. POMyLocationOverlay causes endless redraws
    primarykey
    data
    text
    <p>I am experiencing an unusual behavior on my <code>MapView</code>, i am using RoboGuice by the way i am not sure it could influence the issue.</p> <p>The problem is, if i enable a <code>MyLocationListener</code> on my map, then every overlay on it gets continually redrawn ad infinitum.<br> Give a look at this example:</p> <p>MyMapActivity</p> <pre><code>@ContentView(R.layout.map) public class MyMapActivity extends RoboMapActivity { @InjectView(R.id.map) private MapView map; private List&lt;Overlay&gt; mapOverlays; private MyLocationOverlay compass; private TestOverlay testOverlay; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); map.setBuiltInZoomControls(true); mapOverlays = map.getOverlays(); compass = new MyLocationOverlay(this, map); testOverlay = new TestOverlay(); } @Override protected void onResume() { super.onResume(); compass.enableCompass(); refreshMap(); } private void refreshMap() { mapOverlays.clear(); mapOverlays.add(testOverlay); } @Override protected void onPause() { compass.disableCompass(); super.onPause(); } @Override protected boolean isRouteDisplayed() { return false; } } </code></pre> <p>TestOverlay</p> <pre><code>public class TestOverlay extends Overlay { @Override public void draw(Canvas arg0, MapView arg1, boolean arg2) { System.out.println("drawing..."); super.draw(arg0, arg1, arg2); } } </code></pre> <p>if i run this, i get <code>drawing...</code> printed about ten times per second for ever.<br> but, if i avoid enabling <code>MyLocationOverlay</code>'s compass by commenting out this line:</p> <pre><code>// compass.enableCompass(); </code></pre> <p>then the redrawings stop.<br> any idea about why this happens? is it a bug or am i doing something wrong?</p> <p><strong>Edit</strong></p> <p>Just reproduced it in a project that does not make use of RoboGuice, the problem still occurs.<br> I guess i will do without that compass from now on</p>
    singulars
    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