Android : Caching multiple images in Android

on Thursday, July 3, 2014


My target is to download a set of images from internet and display them in my app using listView. I used robospice-sample-core sample. But here I want to download multiple images. So instead of BitmapRequest class I extended the SpiceService to creat a new class ImagesRequest.



public class ImagesRequest extends SpiceRequest<Bitmap[]> {

}


So the LoadDataFromNetwork Method will return an array of Bitmaps. and I am using them to create my listView. Here is everything is going fine.


for maintaining cache in cachemanager since there is no object persister for array of bitmaps I need to create one extending the InFileObjectPersister() I am facing dificulty in overriding the readCacheDataFromFile() and SaveDataToCacheAndReturnData() methods.


while Executing the spiceRequest since there is only one cacheKey for all the Bitmaps getCacheFile() returns only one file to which all the Bitmaps have to be cached. Can anyone tell how to do that ?


0 comments:

Post a Comment