i had tried something very similar:
package com.whatever.tests;
import android.view.animation.Animation;
import android.view.animation.Transformation;
public class MapScaleAnimation extends Animation {
private OnUpdateListener onUpdateListener;
public void setOnUpdateListener(OnUpdateListener listener){
onUpdateListener = listener;
}
@Override
protected void applyTransformation(float interpolatedTime,
Transformation t) {
if(onUpdateListener != null){
onUpdateListener.onUpdate(interpolatedTime);
}
}
public interface OnUpdateListener {
public void onUpdate(float interpolatedTime);
}
}
then I just implemented OnUpdateListener, gave it an onUpdate method
to handle the delta, and ran it on a dummy view. It looked like it
should be perfect - logged the interpolatedTime (delta) that I
expected, scaled correctly, etc. - there was just this strange
wandering effect when attempting to re-center the map to the same
pivot point (center of viewport) that was visible when the tween was
initiated. I used the same re-centering logic with each approach
(Timer, Thread, Handler, and Animation), and only the Animation
version created that wandering effect - I assume it probably has
something to do with the sequence of onDraw and invalidate, but no
matter what I tried I couldn't suppress it. While the Handler
approach is short, sweet and logical (and doesn't require the dummy
view), I'd still be interested to know what might have caused it.
I've only been working with Android and Java for a couple weeks and am
probably missing something fundamental...
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en