I'm trying to build a Ping Pong game, that the paddle is shown in the bottom of the screen and the bricks is on the top. I use three views, one for the paddle, one for the ball and another one that is the main view that paints the two views (ball and paddle):
public void draw(Canvas canvas){
BallView.draw(canvas);
PaddleView.draw(canvas);
}
What I want to know is if I can identify which view is being touched exactly, I try to do it with onTouchEvent
in the main Activity:
@Override
public boolean onTouchEvent(MotionEvent event){
Log.d("touched", "touched")
return true;
}
But, the problem is that no matter where I touch on the screen, the paddle is moving, and I want, that only when I touch the Paddle he will move. SO, how can I do this, if it is possible? Thanks.