MIDP 3: File Selector

Back | Tutorial Home | Next

FileSelector is a high level component and Screen’s subclass. This component opens a new screen with OK and Cancel commands. This component is fixed and Items cannot be added or removed from this component.

FileSelector(java.lang.String title, int mode)

Mode defines the various ways for file selector can be used

DIRECTORY : This constant should be used to locate a directory. Example: locate a directory to place the media in a Photo Album application.
LOAD : This constant should be used to locate a file. Example: locate an image file to read the media in a Photo Album application.
SAVE : This constant should be used to locate a file to write to. Example: locate an log file do some logging.

Some of the other supported methods

getDirectory(): Get the directory of the selected file.
getFile():Get the selected file.
getFilterExtensions(): Get the MIME types of the files.
setFile(java.lang.String file): Set the file to FileSelector
setDirectory(java.lang.String dir): Set the directory to FileSelector
setFilterExtensions(java.lang.String extensions): Set the MIME types of the files

Back | Tutorial Home | Next

site comments powered by Disqus

More Tutorials

MIDP for Beginners
MIDP Gaming
JSR 179: Location Based Services

This page is a part of a frames based web site. If you have landed on this page from a search engine click here to view the complete page.