开发者

android , refresh image thumbnails , or sd card before calling an intent to choose an image

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/android-developers@googlegroups.com/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 ?


In order to refresh the thumbs just rename the folder that the files are located

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜