audio - Android Soundpool no longer working -


so i've had issue can't quite head around. i've been using static class hold hold soundpool.

e.g.

public class sound  {      private static soundpool sounds;     private static int charged;      public static void loadsound(context context)      {        sounds = new soundpool(5, audiomanager.stream_music, 0);        charged = sounds.load(context, r.raw.charged, 1);     }      public static void playcharged()     {        sounds.play(charged, 1, 1, 1, 0, 1);      } 

then in oncreate method of main activity ( extends basegameactivity ) following:

setvolumecontrolstream(audiomanager.stream_music); sound.loadsound(this);    

so play sound go sound.playcharged() game object attribute of main activity. before, worked great. i'm not sure when stopped working but, can assume once started making major changes. supported google play services put game object in activity.

none of sounds play. however, found sounds play if call method play them within constructor game object or other constructors. assumption happening once i've initialised everything, if being lost.

alright managed solve problem not releasing sounds in onstop method of main activity, new activity instead had created. onstop method called before starting 2nd activity messing sounds.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -