whitech wrote:
> Hi~~
> I've met this problem:
> I want to do something ( like intent another activity ) after an
> animation is over. The code is given below:
> 
>                       TranslateAnimation s = new 
> TranslateAnimation((prev-currentPos)
> *movearea/100, 0, 0, 0);
>                       AlphaAnimation a = new 
> AlphaAnimation((float)prev/currentPos, 1);
>                       star.startAnimation(s);
>                       idle.startAnimation(a);
>                       //do something else
>                       function();
> 
> What I want to do is that the animations has already finish when
> function() start. What can I do ?
> I've struggle on it for a whole day.....

Step #1: Set up an AnimationListener to find out when the animations end:

http://developer.android.com/reference/android/view/animation/Animation.AnimationListener.html

Step #2: In your code above, where your "// do something else" is, use
AsyncTask or some other form of background thread to do the work

Step #3: In the AnimationListener#onAnimationEnd() method, put your
function() call.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Development Wiki: http://wiki.andmob.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to