Skip to content

Instantly share code, notes, and snippets.

@abbas-oveissi
Last active February 28, 2020 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abbas-oveissi/5ba0ee345acc5110fdfa1bb828ad3a11 to your computer and use it in GitHub Desktop.
Save abbas-oveissi/5ba0ee345acc5110fdfa1bb828ad3a11 to your computer and use it in GitHub Desktop.
@Override
public boolean onTouchEvent(MotionEvent event) {
int action = event.getActionMasked();
float x = event.getX();
float y = event.getY();
switch (action) {
case MotionEvent.ACTION_DOWN:
startX = x;
startY = y;
break;
case MotionEvent.ACTION_UP:
break;
case MotionEvent.ACTION_MOVE:
currentX = x;
currentY = y;
invalidate();
break;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment