示例#1
0
 public static String convertSetListToString(ArrayList<GCSavedSet> setArrayList) {
   String setListString = "";
   for (GCSavedSet set : setArrayList) {
     setListString += set.getId();
     setListString += ",";
   }
   return setListString;
 }
示例#2
0
 public static ArrayList<GCSavedSet> convertStringToSetList(
     Context context, String setListString) {
   ArrayList<GCSavedSet> setArrayList = new ArrayList<>();
   String[] stringParts = setListString.split(",");
   ArrayList<GCSavedSet> allSavedSets =
       GCDatabaseHelper.getInstance(context).SAVED_SET_DATABASE.getAllData();
   for (String part : stringParts) {
     for (GCSavedSet set : allSavedSets) {
       if (set.getId() == Integer.parseInt(part)) {
         setArrayList.add(set);
         break;
       }
     }
   }
   return setArrayList;
 }