【问题标题】:Trying to write a hello world CLDC blackberry program试图写一个hello world CLDC黑莓程序
【发布时间】:2011-04-26 07:43:33
【问题描述】:

我得到了 Advance Black Berry 6 Development 一书。 我能够让 midlet 示例工作,但不是 CLDC 程序的第一个示例。似乎它永远不会进入代码,当我运行应用程序时,我会得到一个空白的白屏。 我试图设置一个断点,但它从未中断过。

这里是代码

package test.org;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;

public class cHelloUniverses extends  UiApplication{


    public static void main(String[] args)
     {
         (new cHelloUniverses()).start();
     }


    public void start()
 {
     MainScreen main = new MainScreen();
     LabelField label= new LabelField("Hello Ted");
     main.add(label);

     UiApplication app = UiApplication.getUiApplication();
     app.pushScreen(main);
     app.enterEventDispatcher();

 }


}

【问题讨论】:

    标签: blackberry java-me cldc


    【解决方案1】:

    用这个替换你的 start() 方法:

    public void start()
     {
         MainScreen main = new MainScreen();
         LabelField label= new LabelField("Hello Ted");
         main.add(label);
    
         this.pushScreen(main);
         this.enterEventDispatcher();
    
     }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-24
      • 1970-01-01
      相关资源
      最近更新 更多