I am trying to access general settings from a service. I used the following to save the value of text in a string ...
SharedPreferences sharedPreferences = getPreferences(MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString("Ignore1_value", Example.getText().toString());
editor.commit();
But how do I get the value in the service? Everything I tried returns like nothing. Any help would be perfect and much appreciated?
I looked through other questions, but without a solution. I came up with this, but as I said, it returns it as text.
Context ctx = getApplicationContext();
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(ctx);
String example1string = sharedPreferences.getString("Ignore1_value","");
Log.i("**GetSettings", example1string);
source
share