Open GoogleCodeExporter opened 9 years ago
I got same issue. It is intermittent but I saw the debug message below
//====================================
12-07 18:43:28.457: E/AndroidRuntime(19803): FATAL EXCEPTION: main
12-07 18:43:28.457: E/AndroidRuntime(19803): java.lang.RuntimeException:
Canvas: trying to use a recycled bitmap android.graphics.Bitmap@4070aab0
12-07 18:43:28.457: E/AndroidRuntime(19803): at
android.graphics.Canvas.throwIfRecycled(Canvas.java:955)
12-07 18:43:28.457: E/AndroidRuntime(19803): at
android.graphics.Canvas.drawBitmap(Canvas.java:1044)
12-07 18:43:28.457: E/AndroidRuntime(19803): at
org.osmdroid.tileprovider.MapTileProviderBase$ZoomInTileLooper.handleTile(MapTil
eProviderBase.java:309)
12-07 18:43:28.457: E/AndroidRuntime(19803): at
org.osmdroid.tileprovider.MapTileProviderBase$ScaleTileLooper.handleTile(MapTile
ProviderBase.java:266)
12-07 18:43:28.457: E/AndroidRuntime(19803): at
org.osmdroid.util.TileLooper.loop(TileLooper.java:36)
12-07 18:43:28.457: E/AndroidRuntime(19803): at
org.osmdroid.tileprovider.MapTileProviderBase.rescaleCache(MapTileProviderBase.j
ava:222)
12-07 18:43:28.457: E/AndroidRuntime(19803): at
org.osmdroid.views.MapView.setZoomLevel(MapView.java:342)
12-07 18:43:28.457: E/AndroidRuntime(19803): at
org.osmdroid.views.MapController.setZoom(MapController.java:228)
//================================================
Original comment by jaehyung...@bientus.com
on 7 Dec 2012 at 9:46
Issue 384 has been merged into this issue.
Original comment by kurtzm...@gmail.com
on 3 Jan 2013 at 8:00
This issue is a little more complicated than you'd realize on first glance. It
actually permeates the entire project. Whenever osmdroid gets a tile from the
cache, that tile could be recycled at any time and be rendered useless.
Normally this won't happen - when you request a tile it puts it at the front of
the tile cache "queue" so it will be the last to be removed and recycled. But
under certain circumstances - like this one - that maybe push tiles out of the
queue quickly it could happen.
As of Gingerbread, recycle() shouldn't really need to be called, so we could up
the API requirements and drop the recycle() calls but I don't think we're going
that route just yet.
We could require synchronize() whenever we get a tile from the cache. We would
have to put that everywhere.
The final solution is to just try/catch the tile scalers since that is where
the issue definitively pops up under normal circumstances. That doesn't solve
the larger problem, but since it doesn't seem to pop up in the TileOverlay for
instance then maybe it's all we need.
Original comment by kurtzm...@gmail.com
on 24 Jan 2013 at 10:42
[deleted comment]
In r1149: Updates issue 385. Only call recycle() if < GINGERBREAD. In later
builds there is no need for explicitly calling recycle() and it can cause
exceptions as seen
in issue 385.
Original comment by kurtzm...@gmail.com
on 26 Feb 2013 at 9:16
Original issue reported on code.google.com by
arne.koe...@gmail.com
on 23 Nov 2012 at 2:57