专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Android

为啥手机中照片修改或删除后,还能在手机数据相册中看到原来的内容

发布时间:2010-05-30 04:02:02 文章来源:www.iduyao.cn 采编人员:星星草
为什么手机中照片修改或删除后,还能在手机数据相册中看到原来的内容?
今天用了这段代码去修改了一张图片的内容,在XP的文件管理器中打开此图片时,已无法预览图片。
可是,为什么用手机相册查看时,还能看到原图?是不是读的缓存?要怎么样清除对应图片文件的缓存文件?
public void UpdatePhoto(String photoPath) throws IOException
{

String tmpMsg = String.valueOf((Math.random() + 1) * 1000000);
try
{
// File tmp = File.createTempFile("tmp", null);
// tmp.deleteOnExit();

RandomAccessFile raf = new RandomAccessFile(photoPath, "rw");
long rafLeng = raf.length();
int tmpMsgLeng = tmpMsg.length();
// 创建一个临时文件来保存插入点后的数据
// FileOutputStream tmpOut = new FileOutputStream(tmp);
// FileInputStream tmpIn = new FileInputStream(tmp);

// ----------下面代码插入内容----------
// 把文件记录指针定位到0位置
for (long i = 0; i < rafLeng / tmpMsgLeng - 1; i++)
{
raf.seek(i * tmpMsgLeng);
// 追加需要插入的内容
raf.write(tmpMsg.getBytes());
}
raf.close();
}
}

在手机卡上找到个文件夹:Androiddatacom.cooliris.mediacachehires-image-cache,
这里竟然能找到以前所有被删除掉的照片,这时什么情况?
而且其文件名都是数字,请问原文件名与这个文件夹里对应的文件名如果联系起来?
如果能有办法联系起来,就可以用代码来删除里面对应的文件了。
------解决方案--------------------
在手机卡上找到个文件夹:Androiddatacom.cooliris.mediacachehires-image-cache,
这里竟然能找到以前所有被删除掉的照片,这时什么情况?
而且其文件名都是数字,请问原文件名与这个文件夹里对应的文件名如果联系起来?
如果能有办法联系起来,就可以用代码来删除里面对应的文件了。
我也不会,帮你顶一下吧。。。
------解决方案--------------------
有缓存。 缓存的是图片缩略图

public static final class Images {
        public interface ImageColumns extends MediaColumns {
            /**
             * The description of the image
             * <P>Type: TEXT</P>
             */
            public static final String DESCRIPTION = "description";

            /**
             * The picasa id of the image
             * <P>Type: TEXT</P>
             */
            public static final String PICASA_ID = "picasa_id";

            /**
             * Whether the video should be published as public or private
             * <P>Type: INTEGER</P>
             */
            public static final String IS_PRIVATE = "isprivate";

            /**
             * The latitude where the image was captured.
             * <P>Type: DOUBLE</P>
             */
            public static final String LATITUDE = "latitude";

            /**
             * The longitude where the image was captured.
             * <P>Type: DOUBLE</P>
             */
            public static final String LONGITUDE = "longitude";

            /**
             * The date & time that the image was taken in units
             * of milliseconds since jan 1, 1970.
             * <P>Type: INTEGER</P>
             */
            public static final String DATE_TAKEN = "datetaken";

            /**
             * The orientation for the image expressed as degrees.
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: