Class FilePicker

  extended by net.rim.device.api.ui.picker.FilePicker

public abstract class FilePicker
extends Object

A user interface component for picking a file.

This API can support various options for selecting files. This includes setting a start path so the user is presented first with files in that specific location. It also includes providing a string filter to match the files.

Sample Usage

Getting the file picker and displaying the user interface

        final FilePicker filePicker = FilePicker.getInstance();;

Specifying a start path for the file selection UI

        String startPath = "file://store/home/user/documents"

Specifying a file filter

        String filterString = "jpg"

BlackBerry API 5.0.0

Nested Class Summary
static interface FilePicker.Listener
          Defines the functionality of a listener for when the user has selected a file
Method Summary
abstract  void cancel()
          Remove the display of the File Selection popup
static FilePicker getInstance()
          Returns a file picker.
 void setFilter(String filterString)
 void setListener(FilePicker.Listener listener)
          Sets a listener for the user selecting a path.
 void setPath(String defaultPath)
abstract  String show()
          Displays the File selection popup and returns the full path to the selected file.
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail


public static final FilePicker getInstance()
Returns a file picker. By default, the path is the root, and there is no filter

The instance of FilePicker.
BlackBerry API 5.0.0


public void setFilter(String filterString)
filterString - The filter string is used to reduce the set of files presented to the user. To present only files with the extension of jpg for example, enter a filter string of .jpg
BlackBerry API 5.0.0


public void setPath(String defaultPath)
defaultPath - The default path is the location on the filesystem that will be initially displayed to the user upon presentation of the dialog. If the path does not exist, the root of the device will be presented. The caller should ensure that the path exists before sending it to this function.
BlackBerry API 5.0.0


public abstract String show()
Displays the File selection popup and returns the full path to the selected file. The function will block until a file is selected or the selection process is cancelled. The function will return null if the user cancels.

the fully qualified path to the file selected.
BlackBerry API 5.0.0


public abstract void cancel()
Remove the display of the File Selection popup

BlackBerry API 5.0.0


public void setListener(FilePicker.Listener listener)
Sets a listener for the user selecting a path. When the user accepts or cancels the dialog, the listener class is called

BlackBerry API 5.0.0

Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.