No one will tell you how to create a long click on SurfaceView, my object moves along the surprise and when I use the usual onTouch () it only works once and that's it, but I need until the finger is removed from the screen

  • Well, people, does not anyone know? - dajver 5:56 pm

1 answer 1

  1. If you need to track the trajectory of movement over the surface, it is enough to analyze the events onTouchEvent, looking at the state of MotionEvent (ACTION_DOWN, ACTION_MOVE, ACTION_UP). Then, using the function MotionEvent.getHistoricalXYZ, you can restore the line of motion. Sample approach: TouchPaint .
  2. Use GestureDetector with long click tracking enabled. Then, when defining a long press, a special event will arrive.
  3. Define an OnLongClickListener listener for SurfaceView.
  • In general, I have no idea how to work with this android developers, it’s not clear to me. If I knew how there was and what I wouldn’t write here - dajver