2
edits
Changes
no edit summary
''File->New->Others->BlackBerry Project''
''Note: If you really want really to learn how to build a BB app, then in the wizard choose the ''Empty Application '' option.''
The structure of BB project will be defined, but as the level on of code generation, one will get only an empty Java app, with a code similar with thisone:
<source lang="java">
package mypackage;
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");
3. Add the listener object to the list of source listeners:
buttonField.setChangeListener(listener);
Important note: For expressiveness the steps 2 and 3 are combined to produce code like this:
buttonField.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
ButtonField buttonField = (ButtonField) field;
System.out.println("Button pressed: " + buttonField.getLabel());
}
});
-----------------
Here is the code you must write to add the button ''_buttonGoBack'' to the second screen
<source lang="java">
ButtonField.FIELD_HCENTER | ButtonField.CONSUME_CLICK);
add(_buttonGoBack);
}
}
</source>
-------
In Eclipse, the Project structure should look similar to:
[[File:BBLab-Project.png]]