I need to do play several animation asynchronously, so I've decided to implement AnimationListener with AsyncTask. Unfortunately it throws error RuntimeException: An error acuured while executing doInBackground() at the point I'm starting an animation. Is it possible to get it working with AsyncTask?
Code: public class Game extends Activity {
private static final String TAG = Game.class.getSimpleName();
private Animation animation1;
private Animation animation2;
    ...
    ...
    ...
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.game);
    // animations for turning cards
    this.animation1 = AnimationUtils.loadAnimation(this, R.anim.to_middle);
    this.animation2 = AnimationUtils.loadAnimation(this, R.anim.from_middle);
        ...
        ...
    AsyncTurn turn1 = new AsyncTurn(Game.this, position);
    turn1.execute();
}
AsyncTask:
public class AsyncTurn extends AsyncTask<Void,Void,Void> implements AnimationListener{
    private Context context;
    private int actPosition;
    public AsyncTurn(Context context, int position) {
        this.context = context;
        this.actPosition = position;
        animation1.setAnimationListener(this);
        animation2.setAnimationListener(this);
    }
    @Override
    protected Void doInBackground(Void... params) {
            ((ImageView) gridview.getChildAt(card1.getPosition())).clearAnimation();
            ((ImageView) gridview.getChildAt(card1.getPosition())).setAnimation(animation1);
                // ERROR AT NEXT LINE
            ((ImageView) gridview.getChildAt(card1.getPosition())).startAnimation(animation1);
    }
 
    