I have created a game where if the user presses a button, it moves the snake in that particular direction.
Rather then when you PRESS a button, I want to make it so when the finger is hovering over the button the snake moves instead.
So I have changed my methods from setOnTouchListener
, to setOnHoverListener
here is my code:
Button btnRight = (Button) findViewById(R.id.btnRight);
btnRight.setOnHoverListener(new OnHoverListener(){
public boolean onHover(View v, MotionEvent event) {
if(direction!=4)
direction = 6;
return false;
}
});
When the finger is pressed on the screen and gets dragged over the button, nothing happens.
How would I go about having it register when the finger is dragged over the button? Is there an easy method solution or am I gonna have to detect coordinates, etc?