2
edits
Changes
no edit summary
The second screen must have a title, textfield, and button to let the user go back to the first screen.
* '''Title'''
For the title one could use:
void net.rim.device.api.ui.container.MainScreen.setTitle(Field arg0)
'''setTitle(new LabelField("Second Screen !", LabelField.USE_ALL_WIDTH));'''
* '''Text Field'''
Fot the screen text, one can use the constructor of RichTextField class from the package:
net.rim.device.api.ui.component.RichTextField
'''add(new RichTextField("Here is the second activity", Field.NON_FOCUSABLE));'''
* '''Button''' The package ''net.rim.device.api.ui.component'' contains a class called ''ButtonField''. When the user clicks a ButtonField the objects that are listeners to this event (i.e. click event) are notified. The notification takes placed by invoking its ''fieldChanged()'' method of the ''FieldChangeListener'' interface. For an object to be qualified as a listener two things MUST happend:a. The class of that object must implement the ''FieldChangeListener'' interface.b. The source of the event, namely the button object must add this particular listener to the collection of listeners. Here is a generic code sample:1. Build the source object, the button: ButtonField buttonField = new ButtonField("Test Button"); 2. Build the listener object: FieldChangeListener listener = new FieldChangeListener() { public void fieldChanged(Field field, int context) { ButtonField buttonField = (ButtonField) field; System.out.println("Button pressed: " + buttonField.getLabel()); } }; 3. Add the listener object to the list of source listeners: buttonField.setChangeListener(listener);