Chapter 5. Working with the File System
AIR on BlackBerry Tablet OS provides access to the file system to read, write, and update files of all types. This functionality can be very useful, not only for reading existing files, but also for storing files, media, data, etc. This chapter will demonstrate how to read and write text files, browse the file system for media files, and create and write to an SQLite database.
This chapter has sample applications that require access to the file
system—you will need to select the
permission when creating these projects. See Chapter 3 for help with
File System Access
Just as in the desktop version of Adobe AIR, AIR on BlackBerry Tablet OS provides you access to the file system. The usage is exactly the same.
To access the file system, you can navigate using several folder
static alias properties of the
File class. Since you
are attempting to read these shared files, you will need to select the
access_shared permission when
creating your project.
Let’s take a look at the following code. Within
applicationComplete of the application, the
application1_applicationCompleteHandler method is
called and the static File properties are read and written to a
String variable. This
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" ...
Get Developing BlackBerry Tablet Applications with Flex 4.5 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.