在我的黑莓应用程序中,所有屏幕的屏幕底部都有广告图片(横幅图片)。
在 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);
提前致谢 !!