user1514646
user1514646

Reputation: 1

lwuit httprequesthandler throws java.lang.Error: Static initializer: java/lang/NullPointerException

I am using the HttpRequestHandler in the LWUIT browser example. I get java.lang.Error: Static initializer: java.lang.NullPointerException when I initialise the HttpRequestHandler. This is my code in the 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);

}

Upvotes: 0

Views: 431

Answers (1)

Ajibola
Ajibola

Reputation: 1238

You have to call the network manager's start() before you can perform network operations.

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

Upvotes: 1

Related Questions