My blackberry app will not display on simulator even thou it tells me I have no errors

Posted by user1334120 on Stack Overflow See other posts from Stack Overflow or by user1334120
Published on 2012-04-15T05:11:53Z Indexed on 2012/04/15 5:29 UTC
Read the original article Hit count: 92

Filed under:

I am trying to run this code on my blakberry simulator, but it will not appear on the main menu. Can anybody please help me out.

import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.LabelField; 
import net.rim.device.api.ui.container.MainScreen;

public class FirstScreen extends MainScreen implements FieldChangeListener {
    ButtonField theButton;

    public FirstScreen() {
        add(new LabelField("First Screen"));

        theButton = new ButtonField("New Screen", ButtonField.CONSUME_CLICK);

        theButton.setChangeListener(this);

        add(theButton);
    }

    public void fieldChanged(Field field, int context) {

        if (field == theButton) {
        UiApplication.getUiApplication().pushScreen(new SecondScreen());
        }

    }

    public class SecondScreen extends MainScreen {

        public SecondScreen() {
            add(new LabelField("Second Screen"));
        }
    }
}

© Stack Overflow or respective owner

Related posts about blackberry