开发者

Toggle Sound effects off

开发者 https://www.devze.com 2023-03-21 09:53 出处:网络
I currently want to disable sound effects for my game, which I toggle on or off in a preferences activity.

I currently want to disable sound effects for my game, which I toggle on or off in a preferences activity.

public static  void initSounds(Context theContext)
    {
        
        if(OptionsMenu.getSounds(theContext))
 开发者_运维问答       {
             mContext = theContext;
             mSoundPool = new SoundPool(4, AudioManager.STREAM_MUSIC, 0);
             mSoundPoolMap = new HashMap();
             mAudioManager = (AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
        }
    } 

When I do this however, the soundeffects don't turn off.


If you're using the default SharedPreferences, you should be able to do it by simply doing something like this:

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    nixonMode=prefs.getBoolean("nixonmode", false);
0

精彩评论

暂无评论...
验证码 换一张
取 消