Skip to content

Instantly share code, notes, and snippets.

@meadhikari
Created September 26, 2014 05:54
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 meadhikari/40677b1c1e22220608f8 to your computer and use it in GitHub Desktop.
Save meadhikari/40677b1c1e22220608f8 to your computer and use it in GitHub Desktop.
button.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN) {
// the button is down monitor time to see how long it is down or anything you want
} else if (event.getAction() == MotionEvent.ACTION_UP) {
// the button is up reset your timer
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment