I have a card a game in which the person chooses the card and drags (done through translate animation) and then when let go it moves to the center of the screen where have an imageView place holder. At the animationEnd I set the image view to that card and can invalidate on each view on the screen. What I dont understand is that when I call invalidate then the card looks like it left some trails (shadows from the translate animation). When I call postInvalidate, it gets drawn properly. Why is that??
AnimationEnd code:
@Override
public void onAnimationEnd(Animation arg0) {
if(card == null){
MyApplication.SWERR(null);
busy = false;
}
card.getCardImage().setVisibility(View.INVISIBLE);
Drawable drawable = card.getCardSuitNumber().getDrawable(mContext);
finalDestIV.setBackgroundDrawable(drawable);
finalDestIV.setVisibility(View.VISIBLE);
invalidateAll();
PlayerStatus p = mGameMonitor.getPlayerStatusFromPlayerEnum(GameConstants.PLAYERS.P1);
p.handleCardChosen(card);
cardReleased = false;
p.setPlayerLock(false);
card = null;
}
InvalidateAll method
private void invalidateAll(){
rootLayout.postInvalidate();
for (int i=0; i<rootLayout.getChildCount();i++){
View v = rootLayout.getChildAt(i);
v.postInvalidate();
}
}