How to get screen cordinates corresponding to the whole screen, and not the View touched?

Viewed 19358

Im having some trouble obtaining the real (x,y) from my screen by handling the touch events of one View Item.

I have this:

enter image description here

When I touch the View item, it gives me coordinates with the origin located in his upper-left corner, and if i slide the finger out the view, it gives me negative coordinates (when sliding up or left). enter image description here enter image description here

I would like to obtain the View location in the screen, to add it to the (x,y) coordinates that i get, so the final result is that the (0,0) is in the upper-left corner of the whole screen. enter image description here

I also need the total screen size, so that i know when the finger is located in the lower-right corner.

How can I achieve this?

Thanks.

3 Answers
Related