MotionEvent GetY() and getX() return incorrect values
getX() and getY() returns the values respective to the views that it was called on. Hence Let's say,
ImageView imV = (ImageView)findViewById(R.id.image_view);
Then you can get x,y using
x = imV.getX() + event.getX();
y = imV.getY() + event.getY();
Here I assume you have set the onTouchListener on imV.
Try using getRawX()
and getRawY()
instead of getX()
and getY()
.