File System Access


Just as in the desktop version of Adobe AIR, AIR on Android gives you access to the file system. The usage is exactly the same.

Folder Aliases

To access the file system, you can navigate using several folder static alias properties of the File class.

Let’s review the code below. On applicationComplete, the application1_application CompleteHandler method is called, and the static File properties are read and written to a String variable. This String variable is written to the text property of a TextArea component. Figure 5-1 shows the results. You will notice that many of the aliases return the same value, which is a path to the device’s external storage card:

<?xml version=”1.0″ encoding=”utf-8″?>
<s:Application xmlns:fx=”″
protectedfunction application1_applicationCompleteHandler
var s:String = “”;
s += “File.applicationDirectory : ” +
File.applicationDirectory.nativePath + “nn”;
s += “File.applicationStorageDirectory : ” +
File.applicationStorageDirectory.nativePath + “nn”;
s += “File.desktopDirectory: ” +
File.desktopDirectory.nativePath + “nn”;
s += “File.documentsDirectory : ” +
File.documentsDirectory.nativePath + “nn”;
s += “File.userDirectory : ” +
File.userDirectory.nativePath + “nn”;
info.text = s;
<!– Place non-visual elements (e.g., services, value objects) here –>
<s:Label text=”File System Paths” top=”10″ width=”100%” textAlign=”center”/>
<s:TextArea id=”info” width=”100%” height=”100%” top=”40″ editable=”false”/>

File System Paths