Using ZXing within a Java program is quite easy. First, you need an implementation of com.google.zxing.Reader. You might use an implementation that can detect all formats the library reads:
Reader reader = new MultiFormatReader();
Or, for example, if you knew you were only reading QR Codes, you might instantiate an implementation that only understands QR Codes. This is more efficient.
Reader reader = new QRCodeReader();
Next you need an image to decode. Readers read implementations of com.google.zxing.MonochromeBitmapSource, which are abstractions on top of various classes representing images, presenting them as a monochrome image to be decoded.
For example, an implementation exists for instances of java.awt.BufferedImage:
BufferedImage myImage = ...;
LuminanceSource source = new BufferedImageLuminanceSource(myImage);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
I am not getting "BufferedImage" class. I have to use an instance of BufferedImage calss to pass it to "BufferedImageLuminanceSource".
Also I am unable to include "java.awt.BufferedImage" class since it is available only on "stand alone applications"(swings and applets) and I am using J2ME.
Can anyone please help me out regarding this.
Thanks in advance.

Reply With Quote


