I want every animation, starting with the code below, to start with a delay, like a sequence. So, I have this code:
public void setAnimation(){ View view; String animation = prefs.getString("animations", "Scale"); String interpolator = prefs.getString("interpolators", "Bounce"); Animation animate = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.scale_in); for(int i=0; i<gridView.getChildCount(); i++){ view = gridView.getChildAt(i); view.startAnimation(animate); } }
since there is a for loop, all child animations will run instantly. I already tried:
Thread.sleep.... Handler... animate.setStartTime... animate.setStartOffset...
but all child animations run instantly.
I tried this method inside the loop and the animation does not start:
animate.setAnimationListener(new AnimationListener(){ public void onAnimationEnd(Animation arg0) { view.startAnimation(animate); } public void onAnimationRepeat(Animation arg0) { } public void onAnimationStart(Animation arg0) { } });
Thanx in advance.
source share