Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. public class MainActivity extends Activity {
  2. ...
  3. // This example shows an Activity, but you would use the same approach if
  4. // you were subclassing a View.
  5. @Override
  6. public boolean onTouchEvent(MotionEvent event){
  7.  
  8. int action = MotionEventCompat.getActionMasked(event);
  9.  
  10. switch(action) {
  11. case (MotionEvent.ACTION_DOWN) :
  12. Log.d(DEBUG_TAG,"Action was DOWN");
  13. return true;
  14. case (MotionEvent.ACTION_MOVE) :
  15. Log.d(DEBUG_TAG,"Action was MOVE");
  16. return true;
  17. case (MotionEvent.ACTION_UP) :
  18. Log.d(DEBUG_TAG,"Action was UP");
  19. return true;
  20. case (MotionEvent.ACTION_CANCEL) :
  21. Log.d(DEBUG_TAG,"Action was CANCEL");
  22. return true;
  23. case (MotionEvent.ACTION_OUTSIDE) :
  24. Log.d(DEBUG_TAG,"Movement occurred outside bounds " +
  25. "of current screen element");
  26. return true;
  27. default :
  28. return super.onTouchEvent(event);
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement