iOS dev
iOS dev

Reputation: 470

How to display a webpage content in my blackberry browserfield after getting an Http response?

Im making an Http request where it needs authentication. After succesffully authenticated im getting a response code as 200. Then, how should i display the webpages from the server on to my customized browser field.

Upvotes: 0

Views: 185

Answers (2)

rosco
rosco

Reputation: 939

Here a simple fragment of code that uses BrowserField to display an html page:

    BrowserField browser = new BrowserField();

    String browserContent = "<html><style>" + theStyle + "</style>" + theBody + "</html>";

    byte[] contentBytes;        
    try {
        contentBytes = browserContent.getBytes("UTF-8");
        browser.displayContent(contentBytes, "text/html; charset=UTF-8", "http://mysite.org");
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
        browser.displayContent(browserContent, "http://mysite.org");
    }

Upvotes: 0

String
String

Reputation: 3728

To display a web page on BlackBerry Screen you can check How to - Invoke the browser,If you are working on BlackBerry OS 5.0 you can use Browser field article. Use BrowserField class to display a webpage on your BlackBerry Screen.

Upvotes: 1

Related Questions