I am developing an Android application and I need to handle various touch events.
Consider the following requirements:
-
If the user touches on the right side of the screen I want to display next screen.
-
If user touches on the left side of the screen I want to display previous screen.
On the whole I have about 25 screens.
How can I get the logical coordinates of the screen and trigger the required event?
Override
public boolean onTouchEvent(MotionEvent event) {
Note :
getX()andgetY(), returns the position(x,y) of touch in relation with the View,getRawX()andgetRawY()returns the position ( x,y ) in relation of the screen of your Android phone.