Android doesn't register MotionEvent.ACTION_UP if I press the black space around my phone

27 Views Asked by At

I have this weird issue I can not find any information about online. I am trying to make a stackmat timer app to use when speedcubing. There are two buttons on the left and right side of the screen that are used as "pads" to start and stop the timer. app image

The buttons reach the end of the screen which gives me this weird issue whenever I press the button with one of my fingers on the black space between my phone screen and frame.image for context

Whenever I release the button android doesn't register the event. I have put text above each pad to help me debug why this was happening but I still don't know why it happens. I have used another phone to see if it was a problem with my phone but the same thing happened. I have been trying to solve this problem for days without any luck. If anyone can help I would greatly appreciate it.

    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {

        if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {

            this.isPressed = true;
            this.onPressListener.onPressEvent(new OnPressEvent(this));

        }

        else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {

            this.isPressed = false;
            this.onReleaseListener.onReleaseEvent(new OnReleaseEvent(this));

        }

        return true;

    }
0

There are 0 best solutions below