I am using loader in fragment and when loading is finished then I re-set list adapter's data and start animation using ObjectAnimator.
I coded ObjectAnimator in onLoadFinished(Loader loader, XXX data).
final ObjectAnimator anim = ObjectAnimator.ofInt(new AnimatedPointView(mTextView), "point", oldPoint, data.getPointBalance());
anim.setEvaluator(new TypeEvaluator<Integer>() {
@Override
public Integer evaluate(float fraction, Integer startValue, Integer endValue) {
if (BuildConfig.DEBUG) Ln.d("start="+startValue+", end="+endValue+", fraction="+fraction);
return startValue + Math.round(fraction * (endValue - startValue));
}
});
anim.setInterpolator(new LinearInterpolator());
anim.setDuration(5000);
But this does not work, the evaluate is called twice and the fraction is only 1.0f.
main start=113, end=103, fraction=1.0
main start=113, end=103, fraction=1.0
This animation code works in blank activity's onCreate.
Any suggestion and help would be appreciated.
I added full example code for this.
and if I use NineOldAndroids library, this won't happen. This does not only happen in onLoadFinished method but other places like OnClickListner#onClick.