删除图像中的Android库仍显示我,直到重新启动emaulator [英] Deleted image still shows in android gallery untill I restart the emaulator
问题描述
我删除文件等
File fileToDelete = new File("filepath");
Boolean fileDeleted = fileToDelete.delete();
该fileDeleted是真实的,当我检查DDMS的文件不存在,但如果我点击画廊它仍然显示刚删除的图像。我不得不重新启动模拟器看到的变化。
The fileDeleted is true and when I check the DDMS the file is not there but if I click on the gallery it still shows the image that was just deleted. I have to restart the emulator to see the change.
有没有办法看到的变化,而无需重新启动emaulator?我使用的Eclipse
Is there any way to see the changes without having to restart the emaulator? I'm using eclipse
推荐答案
这是做画廊是如何显示的图像文件。图像文件的缩略图缓存在MediaStore和所有的细节都present在Mediastore的ContentProvider。
It is to do with how Gallery shows the Image files. Image file's Thumbnails are cached in the MediaStore and all the details are present in the Mediastore contentProvider.
删除文件将不会更新这个数据库。但是,当你重新启动模拟器,Mediascanning是由机器人完成。如果MediaScanning可以被触发,画廊将停止显示该文件
Deleting the file will not update this database. But when you restart the emulator, Mediascanning is done by android. If MediaScanning can be triggered , gallery will stop showing the files
这篇关于删除图像中的Android库仍显示我,直到重新启动emaulator的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!