Posts Tagged ‘J2ME’

Android: Getting ARGB from a JPEG

Thursday, January 15th, 2009

With J2ME, “Opening” a JPEG into an ARGB array may look like:

Image jpegImage = Image.createImage( jpegByteArray, 0, arrayLength );
if (jpegImage == null) {
//ERROR
} else {
jpegImage.getRGB (argbArray, 0, jpegWidth, 0, 0, jpegWidth, jpegHeight);
}

Since Android does not have an Image class, the following code will produce the same results (Please note the similar API):

Bitmap jpegBitmap = BitmapFactory.decodeByteArray(jpegByteArray, 0, arrayLength);
if (jpegBitmap == null) {
//ERROR
} else {
decodedBitmap.getPixels(argbArray, 0, jpegWidth, 0, 0, jpegWidth, jpegHeight);
}

Not that different, isn’t it?

(And I know I need a better blockquote for code… working on it)

Android Progress

Monday, January 12th, 2009

The Android application is coming along nicely, networking works perfectly.
But! As I am migrating a J2ME application, I am having difficulties translating the J2ME design to the Android activities.
Will explain more once I decide