简体   繁体   中英

Android Gallery not showing images stored from app

I'm doing a phoneGap app, which makes some changes to a pic and save it back to the //sdcard/Download/ folder. Using third-party app like ES File Explorer, I can see the pic added to the Download folder. However, the Galley does not seem to acknowledge the change even after I hit the refresh button. Any thoughts?

function copyPic(){
window.resolveLocalFileSystemURI(imagefilename, resOnSuccess, fail);

}

function resOnSuccess(entry){

window.requestFileSystem(LocalFileSystem.PERSISTENT, 0,
        function(fileSys) {
            fileSys.root.getDirectory("Download", {create:false, exclusive: false},
                function(directory) {
                    entry.copyTo(directory, "newFile1.JPG", success, fail);
                }, fail);
        }, fail);

}

Simply call:

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

will update your gallery, but it takes some time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM