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

℡╲_俬逩灬. 提交于 2020-01-24 18:51:04

问题


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";
    }
  }

来源:https://stackoverflow.com/questions/26480098/make-cache-images-to-appear-in-gallery-while-using-uinversal-image-loader-in-and

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!