The Android Developer’s Cookbook by James Steele Nelson To

The Android Developer’s Cookbook by James Steele Nelson To

Author:James Steele, Nelson To
Language: eng
Format: epub
ISBN: 9780132464567
Publisher: Cisco Systems, Inc.


The associated main layout is shown in Listing 6.2.

Listing 6.2 res/layout/main.xml

The secondary activity to list the files in a given directory is shown in Listing 6.3. A File object is created based on the directory String passed to the activity. If it is a directory, the files are sorted into reverse chronological order by specifying a new compare() method based on the lastModified() flag of the files.

If instead an alphabetical list is desired, the sort() method can be used. (This is in the ListFiles activity, too, but commented out.) The list is then built and displayed on the screen using a separate layout file R.layout.file_row, which is shown in Listing 6.4.

Listing 6.3 src/com/cookbook/image_manip/ListFiles.java



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.