Hello!
This is my first post here so kindly excuse me if this is in the wrong place.
Ok, this is how I have done the example of "Shared preferences", this is in my helper preferences class:
and this is in one of my activity's classes:
The above is for "shared preferences".
How do I do this for non shared, activity only preferences?
I found this code after googling:
I am so damn confused

This is my first post here so kindly excuse me if this is in the wrong place.
Ok, this is how I have done the example of "Shared preferences", this is in my helper preferences class:
Code:
public static final String GAME_PREFERENCES = "GamePrefs";
Code:
// Adding data
SharedPreferences settings =
getSharedPreferences(GAME_PREFERENCES, MODE_PRIVATE);
SharedPreferences.Editor prefEditor = settings.edit();
prefEditor.putString("lastLaunch", returnTimeAndDateFormatted());
prefEditor.commit();
// Reading
SharedPreferences settings2 =
getSharedPreferences(GAME_PREFERENCES, MODE_PRIVATE);
if (settings2.contains("lastLaunch") == true) {
// System.err.println(settings2.getString("lastLaunch", "Default"));
Log.i("LASTLAUNCH", settings2.getString("lastLaunch", "Not LastLaunch value found!"));
}
The above is for "shared preferences".
How do I do this for non shared, activity only preferences?
I found this code after googling:
but if I get it right that is only to get something that has already been set, it does not say how to set it...Code:SharedPreferences activityPreferences = this.getPreferences(MODE_PRIVATE); String lastLaunch = activityPreferences.getString("lastLaunch", "Not Launched");
I am so damn confused

