Android continues loop for animation
<p>I have tried several kinds of looping in my animation based on the answers here such as animation.setRepeatCount(Animation.INFINITE); or android:repeatcount="infinite" in the anim.xml file..even tried the while(true) loop on java but none seems to work.</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;set xmlns:android="http://schemas.android.com/apk/res/android"
    android:shareInterpolator="false"&gt;

&lt;alpha
    android:fromAlpha="0.0"
    android:toAlpha="1.0"
    android:duration="3000" /&gt;

&lt;translate
    android:fromXDelta="0.0"
    android:toXDelta="0.0"
    android:fromYDelta="0.0"
    android:toYDelta="100.0"
    android:startOffset="3000"
    android:duration="3000"
    android:repeatCount="infinite"/&gt;

&lt;/set&gt;
</code></pre>

<p>and the my java is:</p>

<pre><code>@Override
protected void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    img = (ImageView) findViewById(R.id.img);
    animation = AnimationUtils.loadAnimation(this, R.anim.halloweenanim);

    img.startAnimation(animation);
    animation.setRepeatCount(Animation.INFINITE);

    //hallo.setBackgroundResource(R.drawable.halloweenimg);
    //animation2 = (AnimationDrawable) hallo.getBackground();
    //animation2 = (AnimationDrawable) img.getBackground();
    //animation.start();
};
</code></pre>