Skip to content Skip to sidebar Skip to footer

Issue With Screen Swipe Detection Code

Can someone help me with the code below. I am using this code to detect finger swipe on the screen. import android.app.Activity; import android.content.Intent; import android.util.

Solution 1:

In your switch statement, you need to put a break; at the end of each case.

switch(event.getAction()){

    case MotionEvent.ACTION_DOWN: {
        Log.i("msg", "in MotionEvent.ACTION_DOWN "+event.getX());
        downX = event.getX();
        downY = event.getY();
        break;
        }
    case...

Solution 2:

Adding a line "return true;" in case MotionEvent.ACTION_DOWN solved the problem.

Post a Comment for "Issue With Screen Swipe Detection Code"