Siddiqui
Siddiqui

Reputation: 7840

Marker Blinking on Google Map in Android

I have just started Android application development, I have develop the application of Google map and added the marker on Google map after following this tutorial.

http://mobiforge.com/developing/story/using-google-maps-android

Now I want to blink the marker on Google map, please give the direction so that I can blink the marker on Google map.

Upvotes: 3

Views: 5890

Answers (2)

balazsbalazs
balazsbalazs

Reputation: 4081

Currently there is no way to do it. There is a feature request submitted, please vote on that: http://code.google.com/p/gmaps-api-issues/issues/detail?id=4768&thanks=4768&ts=1357300845

I've tried some workarounds but they are pretty bad:

  1. You can try to use GroundOverlays and play with the setTransparency(). This works, but the overlays scale and rotate with the map (as they should) and usually you don't want that with a marker.
  2. You can add and remove Marker with a different transparency. This is a horrible solution though, as creating a lot of markers consumes a lot of memory and it's also pretty slow.
  3. You can try to draw an overlay view on the Map view, catch the touch events and move the view with the map. The problem with this solution is that it's not smooth, the marker and the map moves "independently" many times.

So all-in-all, it is not really possible and I wasn't able to find a good workaround. Vote up the issue above and hope we got a quick fix. :)

I've created a workaround for a blinking marker you can use it until the Maps team fixes the issue: https://github.com/balazsbalazs/blinking-marker-mapsv2

Upvotes: 1

ingsaurabh
ingsaurabh

Reputation: 15267

From API point of view this is not possible but there might be a workaround that should work I am not sure if it works but theoretically it must

Create a Thread that must redraw the marker at some interval 1sec and change the image alternatively in code where you draw the marker like red image first then greeen and so on

//---add the marker---
Bitmap bmp = BitmapFactory.decodeResource(
getResources(), R.drawable.pushpin);            
canvas.drawBitmap(bmp, screenPts.x, screenPts.y-50, null);  

Upvotes: 2

Related Questions