views:

209

answers:

1

I want to be able to touch (and hold) the screen, and have an event be triggered by this. This is what I have so far.

class Player extends SurfaceView implements SurfaceHolder.Callback 
{

    public boolean onTouchEvent(MotionEvent event) 
    {
         return true;
    }
}

Unfortunately this only recognizes when the touch is 'moving' not when its stationary and held. I don't know what to do with touch events.

A: 

The MotionEvent has what you want - getAction() will return ACTION_DOWN when you press, and you can consider the touch held until you get another event with ACTION_UP or ACTION_CANCEL.

EboMike
Thanks, my problem was within the drawing of my graphics.
Dnxviral