Make Cache Images to appear in gallery while using Uinversal Image Loader in android
Asked Answered
S

0

2

I am using Universal Image Loader lib in my app and caching the images to my sd card. The images are being saved very well, and i can see them using any file explorer in my mobile.

But the images are not shown in gallery.

Is there anyway to make them appear in gallery images too.

EDITE :

File filePath = Environment.getExternalStorageDirectory();
String phNumber[] = Constacts.contactJID.split("@");
String dir = "/Image Messages/"+phNumber[0];
File myCacheDir = new File(filePath, dir);
if(!(myCacheDir .exists())){
    myCacheDir .mkdirs();
}

ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getActivity())
.defaultDisplayImageOptions(defaultOptions)
.memoryCache(new WeakMemoryCache())
.diskCacheSize(100 * 1024 * 1024)
.diskCache(new UnlimitedDiscCache(myCacheDir , myCacheDir ,  new MyFileNameGenerator() ))
.build();

Edited (2nd):

    public class MyFileNameGenerator extends Md5FileNameGenerator {

    @Override
    public String generate(String imageUri) {
        return super.generate(imageUri)+".jpg";
    }
  }
Staging answered 21/10, 2014 at 6:18 Comment(2)
Show how you configure disk cache folder. 'StorageUtils' adds '.nomedia' file into cache folder so it prevents showing cached images in gallery.Coatee
What's your DisplayImageOptions?Coatee

© 2022 - 2024 — McMap. All rights reserved.