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: active AutoText edit

Use an active AutoText edit field to check for patterns in text that a BlackBerry device user types in the field. When a pattern is found, the text becomes active and the user can click on the active text to access special menu items. For example, email addresses and phone numbers are two of the patterns that are recognized by default.

In addition, when the user presses the Space key, text is corrected based on the AutoText definition list, which lists common typographic errors and corrections.

Class

ActiveAutoTextEditField

Supported since

BlackBerry Java SDK 5.0

More information

For more information about active autocomplete text fields, see the UI Guidelines.

Example

This screen shows an active AutoText edit field.

import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.component.ActiveAutoTextEditField;

public class ActiveAutoTextEditFieldDemo extends UiApplication
{
    public static void main(String[] args) 
    {
        ActiveAutoTextEditFieldDemo theApp = new ActiveAutoTextEditFieldDemo();
        
        theApp.enterEventDispatcher();
    }
    
    public ActiveAutoTextEditFieldDemo()
    {
        pushScreen(new ActiveAutoTextEditFieldDemoScreen());
    }
}

class ActiveAutoTextEditFieldDemoScreen extends MainScreen
{
    public  ActiveAutoTextEditFieldDemoScreen()
    {
        setTitle("Active AutoText Edit Field Demo");

        ActiveAutoTextEditField myField = 
              new ActiveAutoTextEditField("Send a message to Mike: \n \n", "");
        
        add(myField);
    }
}