Nachdem ich "gerettet" einen String es (in meinem Fall) zurückkehren wird "Fehler": html_value1 ist "" nichtAndroid Java Sharedpreferences keine Daten speichern
MainActivity:
tools.getEditor(tools.getPreferences(getApplicationContext())).putString("wochea9a", html_value1);
tools.getEditor(tools.getPreferences(getApplicationContext())).putString("wocheb9a", html_value2);
tools.getEditor(tools.getPreferences(getApplicationContext())).commit();
Alarmserviceactivity:
savedwochea9a = tools.getPreferences(getApplicationContext()).getString("wochea9a", "error");
savedwocheb9a = tools.getPreferences(getApplicationContext()).getString("wocheb9a", "error");
Werkzeuge:
public class tools {
static SharedPreferences preferences;
static SharedPreferences.Editor editor;
public static SharedPreferences getPreferences(Context context){
preferences = PreferenceManager.getDefaultSharedPreferences(context);
return preferences;
}
public static SharedPreferences.Editor getEditor(SharedPreferences preferences){
editor = preferences.edit();
return editor;
}
...
Wie ich dieses Problem beheben?