Vishesh Chandra
Vishesh Chandra

Reputation: 7071

How to make animated overlay pin on map Android

I am displaying number of icon on map, now i want those icon should blink, please guide me how to that. can we use two image for light and dim, but main problem is that how to change that overlay image or how to put animation on that image to blink.

Thanks in advance.

Upvotes: 1

Views: 2017

Answers (2)

Rohit Sharma
Rohit Sharma

Reputation: 13815

You have to make a custom view and use it as a Map Overlay.

Tell Its OnDraw() to invallidate whole view after 500ms and everytime drawing again use alternative image.

This link might be helpful to you:

http://blog.pocketjourney.com/2008/03/19/tutorial-2-mapview-google-map-hit-testing-for-display-of-popup-windows/

Upvotes: 0

Vivek Kumar Srivastava
Vivek Kumar Srivastava

Reputation: 2158

if you are using ImageView for icon then put below xml in drawable and use as a Imageview src.

<animation-list   android:id="@+id/my_animation" android:oneshot="false" 
    xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/image1" android:duration="150" />
    <item android:drawable="@drawable/image2" android:duration="150" />
 </animation-list> 

and use below code to set animation

 ImageView img = (ImageView)findViewById(R.id.imageView);
 AnimationDrawable frameAnimation =    (AnimationDrawable)img.getDrawable();
 frameAnimation.setCallback(img);
 frameAnimation.setVisible(true, true);
 frameAnimation.start();

Upvotes: 2

Related Questions