How to load an AnimatorSet with animations defined in xml
<p>I am trying to play several animations in a row, one after the other. These animations will be either simple transforms (moving imageviews a certain distance) or more complex frame animations.</p>

<p>In researching the issue, AnimatorSet seemed to be a good solution at first. It allows you to make a queue of animations to be played, and then execute them in a particular order.</p>

<pre><code>    // defining an example animation
    Animator anim = ObjectAnimator.ofFloat(v, "alpha", 0f)
            .setDuration(100);
    AnimatorSet set = new AnimatorSet();

    // dictating the order in which the animations will be played
    set.playSequentially(anim, skewAnim, wobbleAnim);

    set.start();
</code></pre>

<p>The issue is that, as far as I can tell, you cannot define an Animator object to put in the AnimatorSet from an animation which is defined in an xml file.</p>

<p>Also, AnimationSet (notice different name) only allows you to play several animations all at once, so this class would not work for my purposes.</p>

<p>Does anybody know of a way to define an Animator object from an xml object in your project? Alternatively, is there possibly another way to go about playing a sequence of animations altogether?</p>

<p>UPDATE:</p>

<pre><code>    AnimatorSet set = new AnimatorSet();
    Animator anim1 = AnimatorInflater.loadAnimator(getApplicationContext(), R.animator.sample);
    anim1.setTarget(myView1);
    Animator anim2 = AnimatorInflater.loadAnimator(getApplicationContext(), R.animator.sample);
    anim2.setTarget(myView2);

    anim1.setDuration(3000);
    anim2.setDuration(3000);

    anim1.setInterpolator(new CycleInterpolator(5));
    anim2.setInterpolator(new CycleInterpolator(5));

    set.playSequentially(anim1,anim2);
    set.start();
</code></pre>