hi,
Can anyone know the way how to use createEncodedImage method of EncodedImage class in jde 4.5
Thanks and regards, Vivek Birdi
hi,
Can anyone know the way how to use createEncodedImage method of EncodedImage class in jde 4.5
Thanks and regards, Vivek Birdi
Here's how you would do it if the Image was a resource file of the application:
byte[] imgData = null;
InputStream in = Application.getApplication().
getClass().getResourceAsStream(imgName);
if(in == null) {
// Handle appropriately
}
try {
int length = in.available();
imgData = new byte[length];
in.read(bytes, 0, length);
} finally {
in.close();
}
if(imgData == null) {
// Handle appropriately
}
EncodedImage encodedImage =
EncodedImage.createEncodedImage(imgData, 0, imgData.length);
You could also pass a String as a parameter to define the MIME type. These are the supported MIME types:
Finally, here's the documentation for 4.5: [EncodedImage Javadocs 4.5][1]
[1]: http://www.blackberry.com/developers/docs/4.5.0api/net/rim/device/api/system/EncodedImage.html#createEncodedImage(byte[], int, int)