Note that there are some explanatory texts on larger screens.

plurals
  1. POHow i can display images from URL in blackberry?
    primarykey
    data
    text
    <p>i have simple url of image, i want to display that image in Bitmap Field. this is my class..But it will is not give any result.</p> <pre><code>public class UrlToImage { public static Bitmap _bmap; UrlToImage(String url) { HttpConnection connection = null; InputStream inputStream = null; EncodedImage bitmap; byte[] dataArray = null; try { connection = (HttpConnection) Connector.open(url, 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(); dataArray = result.getBytes(); } catch (final Exception ex) { } finally { try { inputStream.close(); inputStream = null; connection.close(); connection = null; } catch(Exception e){} } bitmap = EncodedImage.createEncodedImage(dataArray, 0,dataArray.length); // this will scale your image acc. to your height and width of bitmapfield int multH; int multW; int currHeight = bitmap.getHeight(); int currWidth = bitmap.getWidth(); multH= Fixed32.div(Fixed32.toFP(currHeight),Fixed32.toFP(480));//height multW = Fixed32.div(Fixed32.toFP(currWidth),Fixed32.toFP(360));//width bitmap = bitmap.scaleImage32(multW,multH); _bmap=bitmap.getBitmap(); } public Bitmap getbitmap() { return _bmap; } } </code></pre> <p>Thanx in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload