Android : Universal image loader displaying different image

on Saturday, March 21, 2015


I'm using universal image loader in my Android app and it's doing something weird.


I have users and each one of them can have different image profile, what I noticed is that when user 1 replaces his image, the UIL seems to load the old one, when I do this,



imageLoader.displayImage("file://" + profileImgFile, imgview);


it displays some old image, but when I do this



myBitmap = BitmapFactory.decodeFile(profileImgFile.getAbsolutePath(), options);
imgview.setImageBitmap(myBitmap);


it displays the new one,


My UIL setting is below,



DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
.cacheOnDisc().imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
.bitmapConfig(Bitmap.Config.RGB_565).cacheOnDisk(true).cacheInMemory(true).build();
ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder( context).defaultDisplayImageOptions(defaultOptions).memoryCache(
new WeakMemoryCache());

ImageLoaderConfiguration config = builder.build();
ImageLoader.getInstance().init(config);


What am I doing wrong?


0 comments:

Post a Comment