Sunday, April 3, 2011

Blackberry launch native web browser

How can i open a url from BlackBerry? in j2me i'm use: this.platformRequest("http://www.google.com");

How can i do on BB?

Thk!!!

From stackoverflow
  • If you want to launch a browser session you would use: Browser.getDefaultSession().displayPage("http://www.google.com");

    If you want to open, and then read the returned data for processing yourself:

    HttpConnection google = (HttpConnection)javax.microedition.io.Connector.open("http://www.google.com"); int rc = google.getResponceCode(); ... InputStream is = google.openInputStream();

    You do need to make sure that processing the connection and returned data does not happen on the event thread or your blackberry will hang.

    Anthony Rizk : Or worse, crash! (if you're using a TCP connection instead of a BES or BIS connection)
  • Browser.getDefaultSession().displayPage("http://www.google.com");
    

    is the correct way to launch the BlackBerry browser with your URL.

  • well i think kozen is right but u can go ahead like this,may be......

    BrowserSession bSession = Browser.getDefaultSession();
    bSession.displayPage(url);
    

0 comments:

Post a Comment