Search code examples
blackberryblackberry-simulatorsmartphone

How to configure your blackberry app works ok (works on simulator but not on smartphone)?


I wrote an app which has 2 screens. The first screen is triggered by the main class. The second screen is opened by clicking a button in the first screen.

public class MyApp extends UiApplication{
    public static void main(String[] args){
        MyApp theApp = new MyApp();       
        theApp.enterEventDispatcher();
    }

    public MyApp(){        
        // Push a screen onto the UI stack for rendering.
        pushScreen(new MyScreen());
    }
} 

public class MyScreen extends MainScreen implements FieldChangeListener
{
    BasicEditField mEdit = null; 
    ButtonField mButton = null;

    public MyScreen() 
    {
        super();                
        mEdit = new BasicEditField("input: ", "some text");
        add(mEdit);
        mButton = new ButtonField("Go second screen");
        mButton.setChangeListener(this);
        add(mButton);
    }
    public void fieldChanged(Field field, int context) 
    {
        if(mButton == field)
        {
            MyScreen2 scr = new MyScreen2();
            scr.setTextValue(mEdit.getText());
            UiApplication.getUiApplication().pushScreen(scr);
            UiApplication.getUiApplication().popScreen(this);
        }
    }
}

public final class MyScreen2 extends MainScreen 
{
    String mTextValue = null;
    LabelField mLabel = null;

    public void setTextValue(String textValue) 
    {
        mTextValue = textValue;
        mLabel.setText(mTextValue);
    }

    public MyScreen2() 
    {
        super();        
        mLabel = new LabelField();
        add(mLabel);
    }
}

It works on the 9700 simulator, but doesn't work on the smartphone. I wonder what is wrong? I wonder if the smartphone blocks loading app from my computer?

I tried signing .cod but nothing changes.

Any idea?


Solution

  • you need signing key to run your application on real device ... It cost near about 20 dollars

    go here you can find all the details from here

    I think it might help you cheers