Hello people,

I'm back to Android developpement with a great pleasure but i'm
experimenting a great problem...

Here is my code explained :

//This function move an element View to a new position described by
xTargeted and yTargeted
private void animateMove(final View v, final int xTargeted, final int
yTargeted){

                //here i'm getting the actual position of the view
                int x = ((AbsoluteLayout.LayoutParams)v.getLayoutParams()).x;
                int y = ((AbsoluteLayout.LayoutParams)v.getLayoutParams()).y;

                //creation of the animation
                TranslateAnimation t = new TranslateAnimation(0,xTargeted-x,
0,yTargeted-y);
                t.setDuration(TaquoidConf.moveDuration);
                t.setInterpolator(new AccelerateInterpolator());

                //defining a listener
                t.setAnimationListener(new AnimationListener(){

                        public void onAnimationEnd(Animation animation) {

                               // !!!!!! Without this thread or just a
call to its content the view goes to its ancient coordinates after
animation
                                Thread th = new Thread(new Runnable(){
                                        public void run() {
                                                v.setLayoutParams(new 
AbsoluteLayout.LayoutParams
(v.getLayoutParams().width,v.getLayoutParams().height, xTargeted,
yTargeted));
                                        }
                                });
                                th.run();
                        }

                        public void onAnimationRepeat(Animation animation) {

                        }

                        public void onAnimationStart(Animation animation)
                        }
                });

                //Launching the animation on the view
                v.startAnimation(t);
        }

If someone have already solved this problem I would enjoy to know the
answer.

Thanks

Fräntz

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

Reply via email to