存List數據
SharedPreferences sp2 = getActivity().getSharedPreferences("ABC", Activity.MODE_PRIVATE);
Gson gson = new Gson();
String data = gson.toJson(list);
SharedPreferences.Editor editor = sp2.edit();
editor.putString("list", data).commit();
取List數據
SharedPreferences sp = getSharedPreferences("ABC", Activity.MODE_PRIVATE);
List<Info> listJson = sp.getString("list", "");
Gson gson = new Gson();
quickGroupList = gson.fromJson(listJson, new TypeToken<List<Info>>() {}.getType()); //將json字符串轉換成List集合