title: Android play sound until explicitly stopped
body: <p>Somebody has already written code for generation a tone with a particular frequency for a given time. The SO link is given here: <a href="https://stackoverflow.com/questions/8698633/how-to-generate-a-particular-sound-frequency">How to Generate A Particular Sound Frequency?</a>.</p>
  
  <p>What I need is, to play the sound indefinitely and not for 3 seconds. I want the sound to stop playing when a button is clicked or something like that. I was thinking maybe I can use timer function to repeat the same loop over and over. When the user clicks 'stop' button I want to invoke audiotrack.pause or stop. Is this a good way to go about it or is there a better logic for this? </p>