Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3985716
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:55:27+00:00 2026-05-20T05:55:27+00:00

It seems that an android animation is not truly finished when the onAnimationEnd event

  • 0

It seems that an android animation is not truly finished when the onAnimationEnd event is fired although animation.hasEnded is set to true.

I want my view to change it’s background drawable on the end of it’s ScaleAnimation which it does, but you can clearly see that it is changed some miliseconds before it finishes. The problem is, that it flickers because the new background appears (=is) scaled for a short time until the animation really finishes.

Is there a way to get either the real end of the animation or just prevent the new background from beeing scaled this short period of time?

Thank you!


//EDIT: I’m using an AnimationListener to get the following call:

    @Override
public void onAnimationEnd(Animation animation)
{
    View view = (MyView) ((ExtendedScaleAnimation) animation).getView();

    view.clearAnimation();
    view.requestLayout();
    view.refreshBackground(); // <-- this is where the background gets changed
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T05:55:28+00:00Added an answer on May 20, 2026 at 5:55 am

    Here is the actual bug related to this issue http://code.google.com/p/android-misc-widgets/issues/detail?id=8

    This basically states that the onAnimationEnd method doesn’t really work well when an AnimationListener is attached to an Animation

    The workaround is to listen for the animation events in the view to which you were applying the animation to
    For example if initially you were attaching the animation listener to the animation like this

    mAnimation.setAnimationListener(new AnimationListener() {
        @Override
        public void onAnimationEnd(Animation arg0) {
            //Functionality here
        }
    });
    

    and then applying to the animation to a ImageView like this

    mImageView.startAnimation(mAnimation);
    

    To work around this issue, you must now create a custom ImageView

    public class MyImageView extends ImageView {
    

    and then override the onAnimationEnd method of the View class and provide all the functionality there

    @Override
    protected void onAnimationEnd() {
        super.onAnimationEnd();
        //Functionality here
    }
    

    This is the proper workaround for this issue, provide the functionality in the over-riden View -> onAnimationEnd method as opposed to the onAnimationEnd method of the AnimationListener attached to the Animation.

    This works properly and there is no longer any flicker towards the end of the animation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It seems that the Android resource compiler does not take into account linked folders
It seems that android has enforced that a listview must have the name android:id=@android:id/list,
From another stackoverflow question, it seems that Android handles large bitmaps differently than other
It seems that I accidentally checked in my gen folder from an Android project
I'm using the stackmob API in an android project and it seems that the
I have to admit that I'm new to Java and Android. db4o seems to
I am using a translate animation: <?xml version=1.0 encoding=utf-8?> <set xmlns:android=http://schemas.android.com/apk/res/android> <translate android:fromXDelta=-75%p android:toXDelta=0%p
What I want is for my app to have that zoom-in animation used by,
I am not sure if I had understood it correctly.. but it seems that
I have an app that's built for Android 2.2, so I'm not using the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.