开发者

Blackberry HTTP Connection

开发者 https://www.devze.com 2023-03-08 09:04 出处:网络
public final class MyScreen extends MainScreen { /** * Creates a new MyScreen object */ public MyScreen() {
public final class MyScreen extends MainScreen {
    /**
     * Creates a new MyScreen object
     */
    public MyScreen() {
        MyScreen myScreen = new MyScreen();
        String 开发者_如何转开发a = myScreen.getPage("http://www.google.com");
        System.out.println("+++  " + a);
    }

    public void parse(String xml) {
    }

    public String getPage(String url) {
        String response = "";

        try {
            StreamConnection s = (StreamConnection) Connector.open(url);
            InputStream input = s.openInputStream();

            byte[] data = new byte[256];
            int len = 0;
            StringBuffer raw = new StringBuffer();

            while (-1 != (len = input.read(data))) {
                raw.append(new String(data, 0, len));
            }

            response = raw.toString();

            input.close();
            s.close();
        } catch (Exception e) {}

        return response;
    }
}

When I execute this program in my Blackberry simulator, I get a StackOverflow error.

How might I resolve this?


checkout this :

1). Http connection error on the blackberry real device

2). http://docs.blackberry.com/en/developers/deliverables/11938/CS_create_first_available_HTTP_connection_857706_11.jsp

this may help you.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号