I have a ArrayList
of Calendar
type, And I need to save its data into SharedPreferences
.
I can save String
ArrayList
data by using this code:
Set<String> setName = new HashSet<String>();
setName.addAll(ignoredProcesses);
SharedPreferences shrdPref = getSharedPreferences("sharePref", MODE_PRIVATE);
SharedPreferences.Editor prefEditor = shardPref.edit();
prefEditor.putStringSet("keyValue", setName);
prefEditor.commit();
But if I'm following the same approach to save Calendar
data, I'm getting error to change Set
type to String
.
How can I save ArrayList <Calendar> list = new ArrayList<Calendar>();
into SharedPreferences
and how I to get it back from SharedPrefernces
.
Your help will be very appreciated. Thank you