0

在我的黑莓应用程序中,所有屏幕的屏幕底部都有广告图片(横幅图片)。

在 Simulator 应用程序中工作正常,但是当我在我的 Strom 2 (9550) 应用程序中安装应用程序时,没有 Banner image 工作正常。

我从我的网络服务中获取所有横幅图像 URL,但是当我尝试从 URL 编码图像以在屏幕上显示时,我无法从 url 编码图像,因此应用程序看起来不太好。

请参阅我下面的编码图像代码

connection = (HttpConnection) Connector.open(bannerImage[i], Connector.READ, true);  
                                        inputStream = connection.openInputStream();  
                                        byte[] responseData = new byte[10000];  
                                        int length = 0;  
                                        StringBuffer rawResponse = new StringBuffer();  
                                        while (-1 != (length = inputStream.read(responseData)))  
                                        {  
                                         rawResponse.append(new String(responseData, 0, length));  
                                        }  
                                        int responseCode = connection.getResponseCode();
                                        if (responseCode != HttpConnection.HTTP_OK)  
                                        {  
                                            throw new IOException("HTTP response code: "  
                                                    + responseCode);  
                                        }  
                                        final String result = rawResponse.toString();

                                         byte[] dataArray = result.getBytes();  
                                         encodeImageBitmap = EncodedImage.createEncodedImage(dataArray, 0, dataArray.length);

提前致谢 !!

4

1 回答 1

0

我得到了这个答案。当我们使用 wifi 使用互联网时,我们必须通过:interface 我将此参数添加到我的图像 url 并且一切正常。

于 2011-09-27T13:58:21.753 回答