4

According to Android documentation, SoundPool.unload returns

true if just unloaded, false if previously unloaded

I create the SoundPool, load 5 sounds and store related 5 sound IDs. Then before leaving the Activity I invoke unload for each of those IDs, and finally I invoke release. What I'm experiencing is the following:

  • if I invoke unload on each ID in some order (the one returned from a map) I systematically receive false for IDs 1..4 and true for ID 5;

  • if I invoke unload in the same order as IDs where loaded, 1 to 5, I systematically receive false for all IDs;

  • if I invoke unload in the opposite order as when loading, 5 to 1, I systematically receive true for IDs 2-5 and false for ID 1

Does anybody know why is this happening, and how to make it such that it returns true? My concern is to not clear up resources properly, and end up in some memory problems after looading/unloading sounds many times.

tshepang
  • 12,111
  • 21
  • 91
  • 136
superjos
  • 12,189
  • 6
  • 89
  • 134

0 Answers0