Android Drag / Animation
<p>I want to make a page where you can drag an image (and play a little animation)</p>

<p>so i'm doing something (and i think it's not ideal - so i need your help):</p>

<p>my code:</p>

<pre><code>ButtonIMG = BitmapFactory.decodeResource(getResources(), R.drawable.ButtonIMG );
Canvas c = null;
while (true) {
    if (!holder.getSurface().isValid()) {
        continue;
    }
    if (gifCounter&lt;10){
        animataion = BitmapFactory.decodeResource(getResources(), R.drawable.animataion1);
        gifCounter++;
    }
    if (gifCounter&lt;20 &amp;&amp; gifCounter&gt;=10){
        animataion = BitmapFactory.decodeResource(getResources(), R.drawable.animataion2);
        gifCounter++;
    }
    if (gifCounter&lt;30 &amp;&amp; gifCounter&gt;=20){
        animataion = BitmapFactory.decodeResource(getResources(), R.drawable.animataion3);
        gifCounter++;
    }
    if (gifCounter&gt;=30){
        gifCounter=0;
    }
    c = holder.lockCanvas();
    c.drawARGB(255, 220, 220, 220);
    c.drawBitmap(ButtonIMG, x, y, null);
    c.drawBitmap(animataion, 100, 100, null);
}
</code></pre>

<p>.
.
.</p>

<pre><code>public boolean onTouch(View v, MotionEvent me){
    switch (me.getAction()) {
        case MotionEvent.ACTION_DOWN:
            x = me.getX();
            y = me.getY();
            break;
    }
}
</code></pre>
