Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (android)
Viewing all articles
Browse latest Browse all 7655

How to delete files of my app contained in the device SD

$
0
0

Hi, for an Android project I download some files to the SD card of my device. This thing automatically creates a new folder with the name com.mydomain.myapp.

At a second time I want to delete the files in this folder.

I believed this could work but it doesn't:

function deleteFilesInExternalDirectory(){
        if(Ti.Filesystem.isExternalStoragePresent()){
            var externalStorage = Ti.Filesystem.externalStorageDirectory;
            var externalStorageFiles = externalStorage.getDirectoryListing();
            for(var i=0;i<externalStorageFiles.length;i++){
// here there could be the code to delete the files but 
// the alert NEVER executes
                alert(externalStorageFiles[i]);
            }
        }
    }
What am I doing wrong? The app freezes after the function call. In the folder there are only ten files or so.

Viewing all articles
Browse latest Browse all 7655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>