Thank you very much~ But there's something hard to do: when my animation runs serveral times, but the "function()" is different in every cases, and it's hard to mark the state. I think if I can block the other thread but the thread where the animation is running is the best way. Can I do it?
On 8月13日, 下午7时37分, Mark Murphy <mmur...@commonsware.com> wrote: > whitechwrote: > > 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/Animati... > > 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 android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---