Your problem is here:
Quote:
FieldChangeListener listener = new FieldChangeListener(){
public void fieldChanged(Field field, int context){
LabelField lbl1 = (LabelField) field;
add(lbl1);
System.out.println("Button pressed:");
}
};
|
The parameter field isn´t a LabelField because you use this listener in a ButtonField. In addiction, you can´t add any Field to the current Screen like that code "add(lbl1)". Try this:
Quote:
FieldChangeListener listener = new FieldChangeListener(){
public void fieldChanged(Field field, int context){
//With this you obtain the control of the current screen
EditFieldScreen screen = (EditFieldScreen) UiApplication.getUiApplication().getActiveScreen() ;
Dialog.inform(screen.edit.getText()); /*You need to put the EditField like an attribute in the EditfieldScreen class*/
}
};
|