Currently I'm developing an Android App for blind people that uses the device's camera.
The app shows in a SurfaceView the preview of the camera's captured frames. When the screen is touched, the app gets the coordinates from the screen, with event.getX()
and event.getY()
. However, what I really want to do is to obtain the coordinates of the touched point but taking as a reference the coordinates of the frame.
With view.getLocationonScreen()
or view.getLocationInWindow()
I can get the location of referred to the top left position where SurfaceView begins, but the frame don't occupies all the surface of the SurfaceView.
How can I transform the coordinates of the screen to relative coordinates to the frame? Or how can I know the coordinates where the frame is located inside the Surface View? When I use getMarginLeft()
or similar I obtain the value 0.