Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
Luis_Pena_Nunez
Posts: 18
Registered: ‎08-23-2012
My Device: Blackberry 9990

browser call method doesn't work

Hi i'm luis.

 

This code is so simple but don't work

 

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

public AphaPreview_0() {
browser browser = new browser();
pushScreen(browser);
}
}

class browser extends MainScreen {
public browser() {
BrowserSession session = Browser.getDefaultSession();
session.displayPage("http://m.facebook.com/");
}
}

When the app start stay in a white screen and doesn't work anymore.

 

Thanks.

Developer
nikita18
Posts: 144
Registered: ‎08-18-2012
My Device: Blackberry Curve 8520

Re: browser call method doesn't work

Try  this:

public class AphaPreview_0 extends UiApplication {

public static void main(String[] args) {
Browser.getDefaultSession().displayPage("http://www.page.com");
AphaPreview_0 preview_0 = new AphaPreview_0();
preview_0.enterEventDispatcher();
}

public AphaPreview_0() {
pushScreen(new Browser());
}
}

class Browser extends MainScreen {
public Browser() {
setTitle("Browse my Page");
}
}