Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9125245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:45:35+00:00 2026-06-17T06:45:35+00:00

I want to play a media when i touch a circular area, but how

  • 0

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 implement the onTouchEvent, and I need the algorithm for deciding if the position is inside or outside the circle.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:45:36+00:00Added an answer on June 17, 2026 at 6:45 am

    You should take position of the view with View.getX() and View.getY() to get x and y of the upper left corner and also assuming You know the radius (or able to obtain width/height of the view to determine radius). After that, obtain xTouch and yTouch using MotionEvent.getX() and MotionEvent.getY() and check if:

    double centerX = x + radius;
    double centerY = y + radius;
    double distanceX = xTouch - centerX;
    double distanceY = yTouch - centerY;
    
    boolean isInside() {
        return (distanceX * distanceX) + (distanceY * distanceY) <= radius * radius;
    }
    

    The formula is just interpretation of schools geometry for determining if dot is inside circle area or not. Refer to circle equation for Cartesian coordinates for more details.

    Values explanation is:

    (x + radius) and (y + radius) is the center of circle.

    (xTouch - (x + radius)) is distance from touch point to center by X.

    (yTouch - (y + radius)) is distance from touch point to center by Y.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Panel to play media. How can I determine if it was
I use media player control to play mp3 files in asp.net application. I want
I want the following on the btn1.Click: if (btn1.Enabled == false) System.Media.SystemSounds.Beep.Play(); Is there
I want to play an animation(Gif) or a movie instead of Default.png. Is that
I want to play a media file in client side using Asp.net,Please tell me
I want to play wowza .mp3 stream on android using default MediaPlayer Library. But
I have a default media player, i want to play videos one by one
I am trying to play a remote video file through intent(default media player) but
I want to play a sound file with mediaplayer and viewpager, but it is
I want to play Media Player in background. Also want to play, stop, pause,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.