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
1 answer
- 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 .
- Use GestureDetector with long click tracking enabled. Then, when defining a long press, a special event will arrive.
- 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
|