If you can guarantee your String
s in ArrayList
don't contain comma, you can simply use
List<String> list = new ArrayList<String>();
...
editor.putString(PREF_KEY_STRINGS, TextUtils.join(",", list));
and to read the list
String serialized = prefs.getString(PREF_KEY_STRINGS, null);
List<String> list = Arrays.asList(TextUtils.split(serialized, ","));
You are limited by the memory of the device. It's good practice to use background thread to read/write shared preferences.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…