android,在调用意图选择图像之前刷新图像缩略图或sd卡
基本上,我正在尝试刷新 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/[电子邮件受保护]/msg24164.html但无济于事
编辑2:我也尝试过删除文件在保存新的之前,但它没有用,缩略图保持不变
编辑3:我使用的设备是htc英雄,我也在lg gt540上尝试过,并且没有出现问题,因为缩略图在覆盖时刷新,这让我相信这可能是 htc 实施的一个错误。还有其他人经历过吗?
basically im trying to refresh the sd card in order to have image thumbnails represent their corresponding pictures. The reason for this is a user can send a picture to the server and the server performs image processing on it and then returns it. It shows up in the gallery as expected the first time. Subsequent requests however result in the first thumbnail always being used for the new image. The new image always overwrites the old one (by design) but the thumbnail stays the same.
currently im trying this to refresh the sd card
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,
Uri.parse("file://"+ Environment.getExternalStorageDirectory())));
It has not worked however. Based on my implementation below is there anyway I could refresh the sd card before the select image intent is started ?
//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 );
EDIT: I have also tried this http://www.mail-archive.com/[email protected]/msg24164.html but to no avail
EDIT 2: I have also tried deleting the files before saving the new ones but its no use the thumbnails just stay the same
Edit 3: The device im using is a htc hero , I have also tried it on an lg gt540 and the problem did not occur as the thumbnails refreshed when overwritten , this leaves me to believe it may be a bug with htc's implementation . Has anyone else experienced this ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了刷新拇指,只需重命名文件所在的文件夹
In order to refresh the thumbs just rename the folder that the files are located