Android - Dynamic marker in GoogleMaps v2 API
<p>I am showing a marker to show user's position in GoogleMaps v2 api in Android, and I am also showing where the user is looking at (kind of like the Google Map app does with the blue dot and the arrow but with custom drawing).</p>

<p>For  this I use a GroundOverlay item and a Thread that redraws the Bitmap:</p>

<pre><code>positionOverlayThread = new Thread()
    {
        public void run()
        {
            while(!stopPositionOverlayThread)
            {
                // We update the bitmap object by re-drawing it
                updatePositionBitmap();
                // We set it as the icon for the overlay
                activity.runOnUiThread(new Runnable()
                {
                    public void run()
                    {
                        BitmapDescriptor posDescriptor = BitmapDescriptorFactory.fromBitmap(positionBitmap);
                        _mPositionOverlay.setImage(posDescriptor);
                        try
                        {
                            Thread.sleep(200);
                        }
                        catch(InterruptedException e)
                        {
                            LogException(e);
                        }                 
                    }
                }
            });
        }
    };
</code></pre>

<p>It seems that this causes a memory leak and I suspect it's coming from the new BitmapDescritor I create every time. Am I not supposed to recycle it on every pass? But I cannot find any way of doing so. </p>

<p><strong>EDIT</strong>: I found <a href="https://code.google.com/p/gmaps-api-issues/issues/detail?id=5061" rel="nofollow">this  thread</a> on gmaps-api but no resolution</p>