tags:

views:

51

answers:

2

Hello,

I have made a music quiz similar to the one in the iPod, everything runs perfect until my program calls a class MP3 ( http://pastebin.com/d52fe24ce ) to stop with the function close(). The problem in my case is that the MP3 is not "instantiated" when it is called. I am not sure but I think this is because the player I created is not null (see Main.java http://pastebin.com/d32ef2c06 around row 261), although there is actually no "instance" of the player... Anyone have any idea how I can make the player close the stream?

+1  A: 

In line 283, you say:

 MP3 player = new MP3...

Here, you create a new local variable. Remove the first "MP3" so the new player gets assigned to the field player:

player = new MP3...
Aaron Digulla
+1  A: 

Line 283:

MP3 player = new MP3(((SongQuestion)question).getSongPath());

should be:

player = new MP3(((SongQuestion)question).getSongPath());

This uses the instance level MP3 player. What you are doing now creates a new local MP3 player that masks the instance level one.

Skip Head
This is what I suspected but didn't know how to actually point the problem out! Thanks, I'll try it!
Philip