i have an image and i animate it to move from left to right according to the layout width().it worked but not in the first time that i open my activity,only after i pushed back from another activity -the animation started. here is the relevant piece in my code:
protected void onResume(){
super.onResume();
sMineAnimatior();
}
protected void onStart(){
super.onStart();
}
protected void onPause(){
super.onPause();
}
public void sMineAnimatior(){
ObjectAnimator bombAnim=ObjectAnimator.ofFloat(bombV,"translationX",0,mainLayout.getWidth());
bombAnim.setDuration(5000);
bombAnim.setRepeatCount(Animation.INFINITE);
bombAnim.setTarget(bombV);
bombAnim.start();
}