androidandroid-animationandroid-viewviewpropertyanimator

ViewPropertyAnimator without start call, is there a difference?


Sometimes I see code like

view.animate().alpha(1).start();

And sometimes

view.animate().alpha(1);

What (if any) is the difference?

The animation always starts but from my understanding of the source code two entirely different things happen in the background before it does so depending on the start call.


Solution

  • public void start ()
    

    Starts the currently pending property animations immediately. Calling start() is optional because all animations start automatically at the next opportunity. However, if the animations are needed to start immediately and synchronously (not at the time when the next event is processed by the hierarchy, which is when the animations would begin otherwise), then this method can be used.

    Source

    The only difference is that with start it starts immediately.