I'm writing an app that uses android's speech recognition.
RecognitionListener I have something like this:
public void onRmsChanged(float rmsdB)
if(mSpeakButtonBorder == null) mSpeakButtonBorder = (ImageView) findViewById(R.id.SpeakButtonBorder);
// Should continue growing in size each time onRmsChanged is called.
Animation animation = new ScaleAnimation(mSpeakButtonBorder.getScaleX(), mSpeakButtonBorder.getScaleX() + 0.1f, mSpeakButtonBorder.getScaleY(), mSpeakButtonBorder.getScaleY() + 0.1f);
Why does the animation only start after recognition has returned with a result?
OnRmsChanged() will normally keep getting called while Speech Recognition is going on. Since you've set fillAfter to true and the duration of the animation to 1000 ms.
So you're infact, starting a new animation in every call to OnRmsChanged() (called every few ms or even more frequently) before the animation actually finishes. Now the problem is that the transformations applied do NOT apply to the View, they just transform the way it's drawn.
I believe the animation is still getting applied. Just that the transformation is too minute to notice, one because of the duration being too small and another because the target scale factor is very small.
So when you use the supposedly current scaleX next time, it actually results in same value as the original (which is 1.0).
You may use an ObjectAnimator to animate, which actually applies the transformations to the View or calculate the relative the input scale values yourself and then feed to ScaleAnimation.