Hello everyone, i have got a small problem. I need to put my retrofit result into my cache, but when i want to get the result and to display it, it shows me null....
This my code to add retrofit result to the cache public static void cacheMesCizoos(List<MesCizoosDto> mescizoos) { // Add in Memory Cache appMemoryCache.put(MESCIZOOS_KEY, mescizoos); // Add in persistant Cache String mescizoosSerialized = new GsonBuilder().create().toJson(mescizoos); try { mescizoosPersitentCache.put(MESCIZOOS_KEY, mescizoosSerialized); } catch(IOException ioe) { } } Saisissez le code ici... And this is my code to get the cache public static List<MesCizoosDto> getTousLesCizoos() { //Get data from the cach Memory if existing List<MesCizoosDto> mescizoos = (List<MesCizoosDto>) appMemoryCache.get(MESCIZOOS_KEY);//Since it's the first time it's null if(mescizoos != null) { return mescizoos; } else { // If there s no memory cache we'll go to the persitant one try { SimpleDiskCache.StringEntry mescizoosSerialized = mescizoosPersitentCache.getString(MESCIZOOS_KEY);//This gives null, this it the prob if (mescizoosSerialized != null) {//Since the one before it's null.... for (int i=0; i<mescizoos.size();i++){ mescizoos.add(i,new GsonBuilder().create().fromJson(mescizoosSerialized.getString(),MesCizoosDto.class)); } //Update cache for next time appMemoryCache.put(MESCIZOOS_KEY, mescizoos); return mescizoos; } } catch (IOException ioe) { ioe.printStackTrace(); } } //If any cache was found return null; } Saisissez le code ici... -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. To post to this group, send email to android-developers@googlegroups.com. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/a8259c38-e514-4a83-a664-9bcafb7f2578%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.