Search code examples
androidtranslate-animation

Delaying animation


What I am looking to do is on button click, activate 3 TranslateAnimation

case R.id.button18Holes:

        //*********************************//
        //***LAUNCHES ACTUAL APPLICATION***//
        //*********************************//
        TranslateAnimation slide = new TranslateAnimation(0, -500, 0,0 );
        slide.setDuration(1000);   
        slide.setFillAfter(true);
        buttonHelp.startAnimation(slide); <-- first
        button9Holes.startAnimation(slide); <-- should start slightly after first
        button18Holes.startAnimation(slide); <-- should start slightly after second

//This should wait until all animations are complete
        Intent myIntent = new Intent(src.getContext(), EasyPar.class);
        startActivityForResult(myIntent, 0);

        break;

Unsure of how to get that effect to slide the buttons off the screen one after the other.


Solution

  • You could try running the animations after a set amount of time using getTransformation(..) or try waiting for each to end by polling the hasEnded() method of the preceding animation.