I have this simple piece of code:
SharedPreferences settings = getSharedPreferences(Constants.USER_DETAILS, 0);
SharedPreferences.Editor editor = settings.edit();
//editor.putLong(Constants.USER_DETAILS_SIGNEDINON, registerResponse.getSignedInOn()); // signed in on
editor.putLong(Constants.USER_DETAILS_SIGNEDINON, 1); // signed in on
long test = settings.getLong(Constants.USER_DETAILS_SIGNEDINON, 2);
if (settings.edit().commit()) {
System.out.print("ok");
} else {
System.out.print("not ok");
}
as you can see I have been playing around to understand what is going on.
So, I have checked the /data/data/... and the preferences file is indeed created but is empty (just the Map tag)
The test long variable returns 2, even if I set it to 1 the line before. The commit returns true.
Am I missing something?
I have set uses-permission android:name=android.permission.WRITE_EXTERNAL_STORAGE though I believe this is only needed when I truly do external storage.
Regards. David.