MyLocationOverlay like class with animation

by Carlos Silva » Sat, 08 May 2010 12:18:19 GMT

Sponsored Links

I'm copying the MyLocationOverlay class, because it is missing something
important to my application. So I decided to reimplement it myself.
I have everything working, except the animation of the dot.

Here's what I have:

this is from my new "MyLocationOverlay" class

public MyPositionOverlay(Context ctx, MapView mapView) {
     gpsLocationImage = (AnimationDrawable)
     netLocationImage = (AnimationDrawable)

public void draw(Canvas canvas, MapView mapView, boolean shadow) {
     /* Some code here */

    Drawable d = GlobalVars.positioner.isGPSFix() ?
gpsLocationImage.getCurrent() : netLocationImage.getCurrent();

     /* Some other code here */

     super.draw(canvas, mapView, shadow);

then, in my mapview's onWindowFocusChanged i have this:

 @Override public void onWindowFocusChanged(boolean hasFocus) {
AnimationDrawable l = myPositionOverlay.getLocationDotDrawable();
                if (hasFocus) l.start(); else l.stop();

What am I doing wrong to only get the first frame on screen?


Other Threads

1. A fan of the Magic --- "Full Of Google Goodness"

Noticed this on an outdoor advertising industry blog:

"Whilst we are Apple fans big time elsewhere in our lives (and in
business) the iPhone just never cut it for us as a useful business
tool. Blackberry are great for email but not best for web access and
a lot of the work that we do is not surprisingly WordPress based."


"We held off getting hold of the first generation of Google phones -
mainly because we didn like the style of the handsets (not the best
reason but important to us nonetheless) but the new HTC Magic phones
both look and feel good.

We have had the new phones for a week now and have been very happy."

Looks like HTC might have a winner on its hands.



2. Animation Xml Resource and CycleInterpolator tag: FAIL

Cycle interpolator does not exist. And it's not how you specify an
animation's interpolator anyway :)

Romain Guy
Android framework engineer

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them


3. How do I add a "EditText" Field to an AppWidget (RemoteViews)

4. What uniquely identifies an application?

5. Dev Phone can not see paid apps using the 1.1 holiday release

6. How do I add a "EditText" Field to an AppWidget (RemoteViews)

7. Developer Distribution Agreement Update