MyLocationOverlay like class with animation

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


Sponsored Links
 Hi,

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)
ctx.getResources().getDrawable(R.anim.gps_fix);
     netLocationImage = (AnimationDrawable)
ctx.getResources().getDrawable(R.anim.network_fix);
}

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 */

     d.draw(canvas);
     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();
super.onWindowFocusChanged(hasFocus);
}


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

--



Other Threads

1. Map not working (again)

Hi,

I just started another project that includes maps and just like in the
previous project, I can't get the maps to work (the code is identical
with the map view tutorial). In my last project, I never managed to
make the maps display on one machine, and it worked right away on the
other one. I have followed the same procedure in both cases and I have
also followed in now.

Are any maps key issues related to hardware known to Google?

Thanks,

Lex
--~--~---------~--~----~------------~-------~--~----~

2. OpenGL 2D Game Framework

I've been working on a game framework for a little while, and while
its far from perfect, I've put the current version online.

To be honest, I haven't used much OpenGL in the past. Before last week
I had never tried using it.
If anyone would like to take a look, please do, I'd appreciate all the
help possible on speeding it up.
There are many features I have in mind and am planning at the minute,
but so far it supports:

# Texture and Sprite management
# Text, using TTF fonts
# Organised layers
# Two audio management classes, one optimized for music, the other for
sound effects
# Sprite dynamics (acceleration, terminal velocity, collisions)
# Animation
# Handlers to manage events fired through movement, animation, screen
touches, accelerometer input, device shaking and collisions
# Several minor features aimed at speeding development, such as screen
settings and vibration

The code is at http://code.google.com/p/rokon/

Again, I'd very much appreciate advice or help with any bugs you can
see, thanks.

--~--~---------~--~----~------------~-------~--~----~

3. coarse versus fine location provider

4. Virtual touch area for an ImageButton

5. pendingIntent vs. Intent for Saurabh Sinha

6. Suggestion for Google team to improve Android Market

7. Booting the target with boot.img generated by Android