Question

i can't get message in Logcat from events : MotionEvent.ACTION_MOVE and MotionEvent.ACTION_UP. I couldn't find solution for it so i ask it here.

I have this overrided method in my class:

@Override
public boolean onTouchEvent(MotionEvent event){
        int action = event.getAction();
        switch (action) {
            case MotionEvent.ACTION_MOVE:
                Log.d("action","Action was MOVE");
            break;
            case MotionEvent.ACTION_DOWN:
                Log.d("action","Action was DOWN");
                break;
            case MotionEvent.ACTION_UP:
                Log.d("action","Action was UP");
                break;
            default:
                break;
        }
    }
    return super.onTouchEvent(event);
}

And in LogCat i can see just message from MotionEvent.ACTION_DOWN : "action" "Action was DOWN" . No messages from other actions.

I try it in my phone and in AVD.

Thanks for any response.

Answer: return must be set to true and not for super constructor.

Was it helpful?

Solution

Just Set return to True and not for super constructor :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top