title: Android - animate View object - specific XML <set>
body: <p>I'm new to Android application programming, and using search i've so far solved all of my problems (stackoverflow being one of the best search hits !)</p>
  
  <p>Now i have a problem i don't know how to solve :</p>
  
  <p>When separate animations are required, i could do it in code, but using XML files in anim folder would be much better for me.</p>
  
  <p>Is it possible to play an animation of a single <code>&lt;set&gt;</code> inside XML file ?
  I mean is it possible to "compress" animations from mulitple XML files into one file and still use them individually ?</p>
  
  <p>Example for normal animation of TextView widget :</p>
  
  <pre><code>TexView exampleTextView = (TextView) findViewById (R.id.example_textview);
  Animation animatorSequence = AnimationUtils.loadAnimation (this, R.anim.example_animation);
  exampleTextView.startAnimation (animatorSequence);
  </code></pre>
  
  <p>XML code with two example  blocks that i would like to use separately</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!--first independant animation segment --&gt;
  &lt;set xmlns:android="http://schemas.android.com/apk/res/android"
  android:fillAfter="true" &gt;
  &lt;translate
      android:fromXDelta="-100%"
      android:toXDelta="0%"
      android:duration="1400" /&gt;
  &lt;/set&gt;
  &lt;!--second independant animation segment --&gt;
  &lt;set xmlns:android="http://schemas.android.com/apk/res/android"
  android:fillAfter="true" &gt;
  &lt;translate
      android:fromXDelta="0%"
      android:toXDelta="100%"
      android:duration="1400" /&gt;
  &lt;/set&gt;
  </code></pre>