基本上我试图刷新 sd 卡,以便让图像缩略图代表它们对应的图片。这样做的原因是用户可以将图片发送到服务器,服务器对其进行图像处理然后返回。它第一次按预期出现在画廊中。然而,后续请求会导致第一个缩略图始终用于新图像。新图像总是覆盖旧图像(根据设计),但缩略图保持不变。
目前我正在尝试刷新 SD 卡
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,
Uri.parse("file://"+ Environment.getExternalStorageDirectory())));
然而,它没有奏效。根据我下面的实现,无论如何我可以在选择图像意图开始之前刷新 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 实现的错误。有没有其他人经历过这个?