preferences = getApplicationContext().getSharedPreferences(PREFERENCES_NAME, 0); SharedPreferences.Editor editor = preferences.edit(); editor.putString(SETTINGS_BACKGROUND_IMAGE, "okok"); editor.apply();