Auto complete field sample app
The auto complete field sample application demonstrates how to create and configure an AutoCompleteField UI component using a variety of data sources.
An AutoCompleteField is a text field that displays a list of values as the user types text in the field. The list contains values that match the field or criteria that you specify.The AutoCompleteField matches what the user types in the field against an associated data source.
The sample application demonstrates how to associate a variety of data sources with the AutoCompleteField. These data sources include the contacts application on the BlackBerry device, the file names of media files on the BlackBerry device, and a list of months.
This sample features the following classes:
This class represents a text field that compares what the user types in the field to a list of possible values and displays a list of matches below the text field. The list of possible matches is defined by a BasicFiltered list object and is set when the AutoCompleteField object is created.
- a list of contacts on the BlackBerry device
- a list of file names of all the image files, music files, and video files that are saved on the BlackBerry device
- a static list of months
This class is an implementation of the FilteredList interface, which an application can use to match data objects with a search string. The AutoCompleteField uses a BasicFilteredList object as its data source. The BasicFilteredList object can handle an array of strings, an array of objects that implement the toString() method, or a supported data source, such as the contacts application on a BlackBerry device.
The sample application uses BasicFilteredList to define the data sources of each AutoCompleteField.
Install the sample app
Visit www.blackberry.com/go/autocompletefieldsample to download the sample application.
Extract the autocompletefielddemo.zip file.
On the taskbar, click Start > Programs > Research In Motion > BlackBerry JDE 5.0 > JDE.
Open the workspace that you want to add the sample application to.
In the workspace tree, right-click the project that you want to add the sample application to.
Click Add project to <workspace directory>.
In the Add project to <workspace> dialog box, browse to the folder where you extracted the sample application.
Click the AutoCompleteFieldDemo.jdp file.
The sample app is also available in github.
Run the sample app
In the workspace where you added the autocompletefielddemo project, right-click autocompletefielddemo.
Click Build project.
On the taskbar, click Start > Applications > Research in Motion > BlackBerry JDE 5.0 > Device Simulator.
On the Home screen of the BlackBerry Smartphone Simulator, click the Downloads folder.
Click the Auto Complete Field Demo icon.