I am having a little trouble writing a correct if-else statement for using a checkbox preference to change the background bitmap of my live-wallpaper. Currently I have this method called up:
 public void setPreferences(SharedPreferences prefs) {
        //Introduce Preference Variables
        p = prefs;
        //Initialize Preference variables
        final boolean mySetting = PreferenceManager.getDefaultSharedPreferences(mContext)
.getBoolean(String.valueOf(R.string.touch), false);
            SharedPreferences.Editor editor = prefs.edit();
            editor.putBoolean(String.valueOf(mySetting), false);
            editor.commit();
        //If statement to set preference value
        if (prefs.getBoolean(String.valueOf(mySetting), true)) {
            GLUtils.texImage2D(GLES10.GL_TEXTURE_2D, 0, nebula, 0);
        }else{
            GLUtils.texImage2D(GLES10.GL_TEXTURE_2D, 0, stars, 0);
        }
    }
Where R.string.touch is the key to my checkbox preference in my XML document, like this:
<CheckBoxPreference
    android:key="@string/touch"
    android:title=""
    android:summary=""
    android:defaultValue="false"/>
So my question is how could I write a correct if-else statement or even a switch-case statement allowing me to switch the background bitmap? Thank you for any help given.
 
     
     
    