Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how can i stop my thread without using .stop()?

 
F.David Ang
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey, i am having problems in stopping a thread in playing music. i tried searching for a way to stop without using .stop() (since is is deprecated), but the stuff i found does not work with my code... sorry i'm a newbie here


I use playmusic player = new playmusic("song.mp3"); and player.start(); to start playing the song... but i dont know any other way on how to stop it besides .stop()... any ideas?
 
Steve Luke
Bartender
Posts: 4181
21
IntelliJ IDE Java Python
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The key is to use APIs and methods that can be interrupted. I don't know anything about the AdvancedPlayer, but does it have a stop, cancel, or interrupt? If so you should Create a method which Calls it. If not, then think about adding one, because without a safe way to stop the music there is no safe way to stop the thread safely.
 
F.David Ang
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the answer. i'll try to search on about what you said
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic