Open main menu

CDOT Wiki β

Changes

Lab BlackBerry Example

1,032 bytes added, 12:37, 27 February 2011
no edit summary
VerticalFieldManager manager = (VerticalFieldManager) getMainManager();
manager.setBackground(BackgroundFactory.createSolidBackground(Color.CORAL));
 
Eventually, your second screen class called ''NextScreen'' could be implemented with the code like this one:
 
<source lang="java">
package mypackage;
 
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.decor.BackgroundFactory;
 
class NextScreen extends MainScreen {
 
public NextScreen() {
 
setTitle(new LabelField("Second Screen !", LabelField.USE_ALL_WIDTH));
VerticalFieldManager manager = (VerticalFieldManager) getMainManager();
manager.setBackground(BackgroundFactory.createSolidBackground(Color.CORAL));
 
add(new RichTextField("Here is the second activity", Field.NON_FOCUSABLE));
 
ButtonField _buttonGoBack = new ButtonField("Go Back",
ButtonField.FIELD_HCENTER | ButtonField.CONSUME_CLICK);
 
_buttonGoBack.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
UiApplication.getUiApplication().popScreen();
}
});
add(_buttonGoBack);
}
}
</source>