2

Possible Duplicate:
Android long-touch event

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.

Community
  • 1
  • 1
Nate-Wilkins
  • 5,364
  • 4
  • 46
  • 61
  • yesterday I was looking for drag&drop feature, i.e. for a listview. I think the behaviour is similar to touch&hold what you described. Maybe this might help you: http://stackoverflow.com/questions/2909311/android-list-view-drag-and-drop-sort/2909341#2909341 – Mathias Conradt Aug 17 '10 at 00:33
  • There's several different versions of gesturelistener. I'm not sure which one SurfaceView should use. It's kind of confusing – Falmarri Aug 17 '10 at 00:34
  • 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 Aug 17 '10 at 00:39
  • Thanks, my problem was within the drawing of my graphics. – Nate-Wilkins Aug 17 '10 at 12:21

0 Answers0