Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

media player destroy song in playing  RSS feed

 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everybody!!!

i have one problem from many time!!!

i have create playlist with one database....if i click the first song i haven't problem bat if a want change the another song when the another is in playing i have problem!!!

how to do destroy the song in playing???

for start the first song i write this code:



how to do destroy the song in playing???

i have also add this code:



but don't to do nothing...why???

help me please!!!
 
Borja Torre
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code inside OnDestroy() is only executed before de activity is destroyed -finished-. You should call release() to stop playing the first song before start playing the next one.
 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i have understand the problem....i don't insert "Service"...how to insert service???
 
Borja Torre
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can find information about how to handle services in Android here: http://developer.android.com/guide/components/services.html

But if you don't need the additional features of a service and you just need to stop one sound before playing another one you could use something like this:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!