Save Array List in shared preferences Android

Get the Arraylist:

String serialized = sharedPrefs.getString(“NAME”, “”);
//Changing this one to linkedlist should solve the java.lang.UnsupportedOperationException problem
myList =  new LinkedList(Arrays.asList(TextUtils.split(serialized,”,”)));

Save the Arraylist:

SharedPreferences.Editor editor = sharedPrefs.edit();
editor.putString(“locked”, TextUtils.join(“,”, myList));
editor.commit();