Button bXMinus = (Button) findViewById(R.id.btnXMinus); bXMinus.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if(event.getAction() == MotionEvent.ACTION_DOWN) { sendMessage("jog x -1"); } else if (event.getAction() == MotionEvent.ACTION_UP) { sendMessage("jog x 0"); } return true; } });