Android 在Animationlistener中使用变量

Android 在Animationlistener中使用变量,android,events,animation,Android,Events,Animation,如何在animationlistener中使用变量 前 for(int i=0;i执行此操作 for(int i = 0; i<ids.length; i++) { ... ... //I want to play a sound on the specific views animationstart final int index = i; // assign to a final variable and use it. s

如何在animationlistener中使用变量

for(int i=0;i执行此操作

for(int i = 0; i<ids.length; i++) {
    ...
    ...
    //I want to play a sound on the specific views animationstart 
    final int index = i;      // assign to a final variable and use it.    
    scalePause.addListener(new AnimatorListenerAdapter() {
    public void onAnimationStart(Animator animation) {
    sounds.play(letterSounds[index ], 1.0f, 1.0f, 0, 0, 1.0f);
}
for(int i=0;i
for(int i = 0; i<ids.length; i++) {
    ...
    ...
    //I want to play a sound on the specific views animationstart 
    final int index = i;      // assign to a final variable and use it.    
    scalePause.addListener(new AnimatorListenerAdapter() {
    public void onAnimationStart(Animator animation) {
    sounds.play(letterSounds[index ], 1.0f, 1.0f, 0, 0, 1.0f);
}