Would you like to tell us how we are doing?

You bet No thanks

Sorry about the red box, but we really need you to update your browser. Read this excellent article if you're wondering why we are no longer supporting this browser version. Go to Browse Happy for browser suggestions and how to update.

Text field: autocomplete

Use an autocomplete text field to allow BlackBerry device users to select from a changing list of words that match the characters that they type in the field. Users can select one of the presented matches or continue typing to further restrict the available choices.

When you create an autocomplete text field, you must associate it with a BasicFilteredList object. The BasicFilteredList supplies the strings to compare against, which can be hard-coded or derived from data sources on a BlackBerry device, such as contacts, memos, and tasks.




Supported since

BlackBerry Java SDK 5.0

More information

For more information about autocomplete text fields, see the UI & Navigation Development Guide.


This screen shows an autocomplete text field.

import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.component.AutoCompleteField;
import net.rim.device.api.collection.util.*;

public class AutoCompleteFieldApp extends UiApplication 
    public static void main(String[] args) 
        AutoCompleteFieldApp app = new AutoCompleteFieldApp();
    	   pushScreen(new HomeScreen());

class HomeScreen extends MainScreen
    public HomeScreen()
								setTitle("Autocomplete Text Field Demo");
        BasicFilteredList filterList = new BasicFilteredList();
        String[] days = {"Monday","Tuesday","Wednesday",
        AutoCompleteField autoCompleteField = 
              new AutoCompleteField(filterList);