Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
For an android app, I have an ImageView, set to Translate animation. I want real time coordinates of the ImageView when it is moving.

Java
public void run() {

                runOnUiThread(new Runnable() {
                    public void run() {

                        ImageView myimage = (ImageView)findViewById(R.id.myimage);

                        Animation animation = new TranslateAnimation(100, 200, 300, 400);
                        animation.setDuration(1000);
                        myimage.startAnimation(animation);
                        animation.setRepeatCount(Animation.INFINITE);

                        int x = myimage.getLeft();
                        int y = myimage.getTop();

                    }
                });

            }
        }, 1000, 1000);


Variables x and y don't change real time and only give original static coordinate of the ImageView.

How can I get the real time coordinates as the ImageView is in motion ?
Posted
Updated 15-Feb-15 14:11pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900