android frame animation run infinitely



i have a xml frame animation and i want it to run just once .. but it keeps running infinitely .. even if i used isOneShot()


that's my code



import android.app.Activity;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.widget.ImageView;
import de.vrallev.tutorial.dialer.R;

public class testanim extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.animtest);
ImageView iv = (ImageView) findViewById(R.id.imageView1);
iv.setImageBitmap(null);
iv.setBackgroundResource(R.anim.animation);

final AnimationDrawable mailAnimation = (AnimationDrawable) iv
.getBackground();
mailAnimation.isOneShot();
mailAnimation.start();

No comments:

Post a Comment