我正在构建一个从Web下载图像并将它们存储到我的SD卡中的应用程序,为了使它们在库中不可见,我将这一行生成一个.nomedia文件:
FileWriter f = new FileWriter("/sdcard/Android/data/CopyImage/cache/.nomedia");
Run Code Online (Sandbox Code Playgroud)
应用程序可以成功下载图像并将.nodata文件放在同一个文件夹中,但事实是,图像仍然出现在图库中.
怎么会这样?任何人都可以为我提供解决方案吗?
非常感谢你
我正在使用imageLoader类从url加载图像.但是那些所有图像都通过名为LazyList的文件夹名称存储在库中.它需要高达40 -100 MB的内存.但我不想加载图像,因为用户可能会感到不适.对不起英语不好.
一切正常但它在图库中创建了一个文件夹,并显示了我的应用程序正在使用的所有图像.所以我觉得用户会觉得用户不舒服.
这是我的imageloader代码,甚至还与其他几个类链接
public class ImageLoader {
MemoryCache memoryCache = new MemoryCache();
FileCache fileCache;
private Map<ImageView, String> imageViews = Collections
.synchronizedMap(new WeakHashMap<ImageView, String>());
ExecutorService executorService;
public ImageLoader(Context context) {
fileCache = new FileCache(context);
executorService = Executors.newFixedThreadPool(5);
}
final int stub_id = R.drawable.abs__ab_bottom_transparent_light_holo;
public void DisplayImage(String url, ImageView imageView) {
imageViews.put(imageView, url);
Bitmap bitmap = memoryCache.get(url);
if (bitmap != null)
imageView.setImageBitmap(bitmap);
else {
queuePhoto(url, imageView);
imageView.setImageResource(stub_id);
}
}
private void queuePhoto(String url, ImageView imageView) {
PhotoToLoad p = new …Run Code Online (Sandbox Code Playgroud)