lwuit httprequesthandler抛出java.lang.Error:静态初始化器:java / lang / NullPointerException

时间:2012-07-10 11:50:38

标签: lwuit

我在LWUIT浏览器示例中使用HttpRequestHandler。我初始化HttpRequestHandler时得到java.lang.Error:Static initializer:java.lang.NullPointerException。这是我在startApp中的代码。  public void startApp(){

Display.init(this);

try {
    InputStream imageStream= Home.class.getResourceAsStream("tipster.res");
    //String filesPathAndName = url.getPath();        
      Resources r = Resources.open(imageStream);
      UIManager.getInstance().setThemeProps(r.getTheme("Theme 2"));
    } catch (IOException ioe) {
        ioe.printStackTrace();
      // Do something here.
    }

 HttpRequestHandler handler = new HttpRequestHandler();
    HTMLComponent h = new HTMLComponent(handler);
    h.setPage("http://m.google.com");
    ffForm.addComponent(h);

}

1 个答案:

答案 0 :(得分:1)

您必须先调用网络管理员的start()才能执行网络操作。

   NetworkManager.getInstance().start();
        Storage.init("LWUITtester");