I though I could somehow give the user an option of muting the sound in the splash screen(Click here to check out the sourcecode). So in here i set up the preferences, Now we want to read those preferences and use them accordingly. I modified the splash screen such that it will only play music if the user has set it to.
So first you have to access the Preferences:
SharedPreferences getPrefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
Now well check the value of the checkbox and store it in boolean variable playMusic
boolean playMusic = getPrefs.getBoolean("sound", true);
Now to the block of code should look like:
SharedPreferences getPrefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); boolean playMusic = getPrefs.getBoolean("sound", true); if(playMusic) song.start();
Mauricio Ponce (@th4n0)
April 22, 2013 at 3:07 pm
thanks, it was very useful