Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find animation is finished playing in android


Here is a simple code to animate webview screen. But the problem is, the screen get scrolled before the animation take place..but i need apply animation for current screen... how can i solve this?

here is my piece of Code

if(e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {

     mWebView.startAnimation(AnimationUtils.loadAnimation(context, R.anim.page_slide_left_in));  
     mWebView.startAnimation(AnimationUtils.loadAnimation(context,R.anim.page_slide_left_out));

    mWebView.scrollBy(mWebView.getWidth(),0);
}
like image 789
vnshetty Avatar asked May 05 '11 10:05

vnshetty


People also ask

How do I view animations on Android?

You can use the view animation system to perform tweened animation on Views. Tween animation calculates the animation with information such as the start point, end point, size, rotation, and other common aspects of an animation.

How do I turn off animation on my phone?

Open Settings . Scroll down and select Accessibility. Scroll down to Display and tap Text and display. Tap the toggle switch for Remove animations to turn it on.

What is animation on my Android phone?

Animations can add visual cues that notify users about what's going on in your app. They are especially useful when the UI changes state, such as when new content loads or new actions become available. Animations also add a polished look to your app, which gives it a higher quality look and feel.


1 Answers

The android.view.animation.Animation class (returned by AnimationUtils.loadAnimation has a nested interface called AnimationListener which you can use to determine when an animation has completed. Specifically, you'd be interested in implementing the onAnimationEnd method of the listener interface.

Obviously, you'd also have to call setAnimationListener on the Animation instance returned by loadAnimation.

like image 146
slyfox Avatar answered Sep 28 '22 05:09

slyfox