问题
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