1

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);

}

1 Answer 1

3

Simply call:

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

will update your gallery, but it takes some time.

2
  • Thanks xtr. I'm using phoneGap, so wondering if there exists similar methods there?
    – Yang
    Apr 2, 2013 at 3:23
  • 1
    Write your own plugin, or provide JavaScript interface with addJavascriptInterface method of WebView to call that native function. You can see detail in this answer: stackoverflow.com/questions/8733692/…
    – xtr
    Apr 2, 2013 at 3:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.