I want to play a media when i touch a circular area, but how can I could determine that my touch position is in the circle?
So far I extend a view
and imple
Another way to do this, and a little simpler I think, is to use the distance between two points formula and compare that distance to your radius. If the calculated distance is less than the radius then the touch is inside your circle.
Here the code
// Distance between two points formula
float touchRadius = (float) Math.sqrt(Math.pow(touchX - mViewCenterPoint.x, 2) + Math.pow(touchY - mViewCenterPoint.y, 2));
if (touchRadius < mCircleRadius)
{
// TOUCH INSIDE THE CIRCLE!
}