March 2018
Beginner
274 pages
6h 1m
English
So, that covers simple interactions. How about we add another gesture to allow the user to clear all the attachment points and thus remove the Andy robot from the scene. Follow along the given steps to add another touch gesture:
// Set up tap listener.gestureDetector = new GestureDetector( this, new GestureDetector.SimpleOnGestureListener() { @Override public boolean onSingleTapUp(MotionEvent e) { onSingleTap(e); return true; } @Override public boolean onDown(MotionEvent e) { return true; } });surfaceView.setOnTouchListener( new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return gestureDetector.onTouchEvent(event); } });
Read now
Unlock full access