Redrawing bitmap on Google Maps v2 for Android
android, google-maps-android-api-2
Solution
One optimization could be to check if the new position is the same as the old one and don't redraw if that is the case. Also I don't think that the descriptor need to be created each time.
Another approach for moving markers is described here. It's the one from the official sample.
Problem
In this scenario I want to draw a bitmap on Google Maps using `gms v2` and each user position update enforces bitmap update. Currently I use following code snippet: ``` public void init(){ result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); canvas = new Canvas(result); } public void update(){ // draw on canvas ... draw(result); } public void draw(Bitmap modifiedBmp) { if (overlay != null) { overlay.remove(); } BitmapDescriptor descriptor = BitmapDescriptorFactory.fromBitmap(modifiedBmp); overlay = map.addGroundOverlay(new GroundOverlayOptions().image(descriptor).positionFromBounds(bounds).zIndex(100)); } ``` The `update()` method is called each second. I find this approach extremely inefficient and I'm searching for a better solution (i.e. that doesn't require to add/remove overlay after each update). Drawing primitives on map using `addPolygon(...)` and `addPolyline(...)` isn't an option because I require drawing capabilities not present in standard api.