gpt4 book ai didi

在调用选择图像的 Intent 之前,android 、刷新图像缩略图或 sd 卡

转载 作者:行者123 更新时间:2023-11-29 00:48:10 24 4
gpt4 key购买 nike

基本上,我正在尝试刷新 SD 卡,以便让图像缩略图代表它们对应的图片。这样做的原因是用户可以向服务器发送图片,服务器对其进行图像处理然后返回。它第一次出现在画廊中。然而,后续请求会导致第一个缩略图始终用于新图像。新图像总是会覆盖旧图像(按设计),但缩略图保持不变。

我正在尝试用这个来刷新 sd 卡

sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, 
Uri.parse("file://"+ Environment.getExternalStorageDirectory())));

然而,它并没有奏效。根据我下面的实现,我是否可以在启动选择图像 Intent 之前刷新 SD 卡?

 //if the user selects the file browser
//open the file browser and present the available images
if(v == choose){

//refresh the sd card before viewing the images
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,
Uri.parse("file://"+ Environment.getExternalStorageDirectory())));

startActivityForResult(new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI), SELECT_IMAGE );

编辑:我也试过这个http://www.mail-archive.com/android-developers@googlegroups.com/msg24164.html但无济于事

编辑 2:我也曾尝试在保存新文件之前删除文件,但它没有用,缩略图只是保持不变

编辑 3:我使用的设备是 htc hero,我也在 lg gt540 上试过,问题没有出现,因为覆盖时缩略图会刷新,这让我相信这可能是 htc 实现的一个错误.有没有其他人遇到过这种情况?

最佳答案

为了刷新缩略图只需重命名文件所在的文件夹

关于在调用选择图像的 Intent 之前,android 、刷新图像缩略图或 sd 卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5134136/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com