android - SoundPool crashes in two scenarios. Code for first scenario crashes -
@ian g. clifton here code first type of soundpool tried. when button load activity program fcs previous activity. code starts here doesn't transfer over:::::: public class soundmanager { private soundpool msoundpool; private hashmap<integer, integer> msoundpoolmap; private audiomanager maudiomanager; private context mcontext; public soundmanager() { } public void initsounds(context thecontext) { mcontext = thecontext; msoundpool = new soundpool(16, audiomanager.stream_music, 0); msoundpoolmap = new hashmap<integer, integer>(); maudiomanager = (audiomanager)mcontext.getsystemservice(context.audio_service); } public void addsound(int index,int soundid) { msoundpoolmap.put(index, msoundpool.load(mcontext, soundid, 1)); } public void playsound(int index) { int streamvolume = maudiomanager.getstreamvolume(audiomanager.stream_music); ...