0
votes

Im building a Test Maker App. I need some help on loading files in Android mobile. The type i want is the type where the user can look for his file from a file browser. This is the code i have so far but it wont work. My mobile always says "No files were found".

   var file = File.applicationStorageDirectory.resolvePath("saved projects");//This is a folder
   file.browseForOpen("Open Your File", [new FileFilter("Text Files", "*.txt")]);
   file.addEventListener(Event.SELECT, onFileSelected);

    public function onFileSelected(e:Event):void {
        var stream:FileStream = new FileStream();
        stream.open(e.target as File, FileMode.READ);
        loadTxt.text = stream.readUTF();
    }

Plus additional question: Where is the best location to save files in the ANdroid mobile?

1

1 Answers

0
votes

You can write your file manager, it should not be difficult. Scan a directory with method "getDirectoryListing":

var file:File = File.applicationDirectory.resolvePath('myDirectory/');
var filesList:Array = file.getDirectoryListing();

and show a list of files.