下面列出了怎么用com.google.zxing.MultiFormatReader的API类实例代码及写法,或者点击链接到github查看源代码。
public BitmapDecoder(Context context) {
multiFormatReader = new MultiFormatReader();
// 解码的参数
Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>(
2);
// 可以解析的编码类型
Vector<BarcodeFormat> decodeFormats = new Vector<BarcodeFormat>();
if (decodeFormats == null || decodeFormats.isEmpty()) {
decodeFormats = new Vector<BarcodeFormat>();
// 这里设置可扫描的类型,我这里选择了都支持
decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
}
hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);
// 设置继续的字符编码格式为UTF8
hints.put(DecodeHintType.CHARACTER_SET, "UTF8");
// 设置解析配置参数
multiFormatReader.setHints(hints);
}
/**
* 使用YUV解析bitmap
*
* @param data
* @param width
* @param height
* @param hintTypeMap
* @return
*/
private Result decodeFromYUV(int[] data, int width, int height, Map<DecodeHintType, ?> hintTypeMap) {
Result result = null;
byte[] yuv = convertRGBToYuv(data, new byte[width * height], width, height);
PlanarYUVLuminanceSource source = new PlanarYUVLuminanceSource(yuv, width, height, 0, 0, width, height, false);
BinaryBitmap binaryBitmap = new BinaryBitmap(new HybridBinarizer(source));
try {
result = new MultiFormatReader().decode(binaryBitmap, hintTypeMap);
} catch (NotFoundException e) {
//使用GlobalHistogramBinarizer算法进行解析
try {
result = new MultiFormatReader().decode(new BinaryBitmap(new GlobalHistogramBinarizer(source)), hintTypeMap);
} catch (NotFoundException e1) {
e1.printStackTrace();
}
}
return result;
}
/**
* 解析二维码
*
* @param file
* 二维码图片
* @return
* @throws Exception
*/
public static String decode(InputStream in) throws Exception {
BufferedImage image = ImageIO.read(in);
if (image == null) {
return null;
}
BufferedImageLuminanceSource source = new BufferedImageLuminanceSource(image);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
Result result;
Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>();
hints.put(DecodeHintType.CHARACTER_SET, CHARSET);
result = new MultiFormatReader().decode(bitmap, hints);
String resultStr = result.getText();
in.close();
return resultStr;
}
/**
* Decode barcode from YUV pixels array
*
* @param pixels YUV image data
* @param width Image width
* @param height Image height
* @param rotation Degrees to rotate image before decoding (only 0, 90, 180 or 270 are allowed)
* @param reverseHorizontal Reverse image horizontally before decoding
* @param hints Decoder hints
* @return Decode result, if barcode was decoded successfully, {@code null} otherwise
* @see DecodeHintType
*/
@Nullable
@SuppressWarnings("SuspiciousNameCombination")
public static Result decodeYuv(@NonNull final byte[] pixels, final int width, final int height,
@Rotation final int rotation, final boolean reverseHorizontal,
@Nullable final Map<DecodeHintType, ?> hints) {
Objects.requireNonNull(pixels);
final byte[] rotatedPixels = Utils.rotateYuv(pixels, width, height, rotation);
final int rotatedWidth;
final int rotatedHeight;
if (rotation == ROTATION_90 || rotation == ROTATION_270) {
rotatedWidth = height;
rotatedHeight = width;
} else {
rotatedWidth = width;
rotatedHeight = height;
}
final MultiFormatReader reader = createReader(hints);
try {
return Utils.decodeLuminanceSource(reader,
new PlanarYUVLuminanceSource(rotatedPixels, rotatedWidth, rotatedHeight, 0, 0,
rotatedWidth, rotatedHeight, reverseHorizontal));
} catch (final ReaderException e) {
return null;
}
}
@Nullable
@SuppressWarnings("SuspiciousNameCombination")
public Result decode(@NonNull final MultiFormatReader reader) throws ReaderException {
int imageWidth = mImageSize.getX();
int imageHeight = mImageSize.getY();
final int orientation = mOrientation;
final byte[] image = Utils.rotateYuv(mImage, imageWidth, imageHeight, orientation);
if (orientation == 90 || orientation == 270) {
final int width = imageWidth;
imageWidth = imageHeight;
imageHeight = width;
}
final Rect frameRect =
Utils.getImageFrameRect(imageWidth, imageHeight, mViewFrameRect, mPreviewSize,
mViewSize);
final int frameWidth = frameRect.getWidth();
final int frameHeight = frameRect.getHeight();
if (frameWidth < 1 || frameHeight < 1) {
return null;
}
return Utils.decodeLuminanceSource(reader,
new PlanarYUVLuminanceSource(image, imageWidth, imageHeight, frameRect.getLeft(),
frameRect.getTop(), frameWidth, frameHeight, mReverseHorizontal));
}
public CameraPreview(Context context, Camera camera) {
super(context);
mCamera = camera;
mContext = context;
mHolder = getHolder();
mHolder.addCallback(this);
// deprecated setting, but required on Android versions prior to 3.0
mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
Parameters params = mCamera.getParameters();
mWidth = 640;
mHeight = 480;
params.setPreviewSize(mWidth, mHeight);
mCamera.setParameters(params);
mMultiFormatReader = new MultiFormatReader();
mDialog = new AlertDialog.Builder(mContext).create();
}
public Result decodeWithZxing(Bitmap bitmap) {
MultiFormatReader multiFormatReader = new MultiFormatReader();
multiFormatReader.setHints(changeZXingDecodeDataMode());
int width = bitmap.getWidth();
int height = bitmap.getHeight();
int[] pixels = new int[width * height];
bitmap.getPixels(pixels, 0, width, 0, 0, width, height);
Result rawResult = null;
RGBLuminanceSource source = new RGBLuminanceSource(width, height, pixels);
BinaryBitmap binaryBitmap = new BinaryBitmap(new HybridBinarizer(source));
try {
rawResult = multiFormatReader.decodeWithState(binaryBitmap);
} catch (ReaderException re) {
// continue
} finally {
multiFormatReader.reset();
}
return rawResult;
}
/**
* 条形码解码
*
* @param imgPath
* @return String
*/
public static String decode(String imgPath) {
BufferedImage image = null;
Result result = null;
try {
image = ImageIO.read(new File(imgPath));
if (image == null) {
System.out.println("the decode image may be not exit.");
}
LuminanceSource source = new BufferedImageLuminanceSource(image);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
result = new MultiFormatReader().decode(bitmap, null);
return result.getText();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 二维码解码
*
* @param imgPath
* @return String
*/
public static String decode2(String imgPath) {
BufferedImage image = null;
Result result = null;
try {
image = ImageIO.read(new File(imgPath));
if (image == null) {
System.out.println("the decode image may be not exit.");
}
LuminanceSource source = new BufferedImageLuminanceSource(image);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>();
hints.put(DecodeHintType.CHARACTER_SET, "GBK");
result = new MultiFormatReader().decode(bitmap, hints);
return result.getText();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@Override
public Decoder createDecoder(Map<DecodeHintType, ?> baseHints) {
Map<DecodeHintType, Object> hints = new EnumMap<DecodeHintType, Object>(DecodeHintType.class);
hints.putAll(baseHints);
if(this.hints != null) {
hints.putAll(this.hints);
}
if(this.decodeFormats != null) {
hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);
}
if (characterSet != null) {
hints.put(DecodeHintType.CHARACTER_SET, characterSet);
}
MultiFormatReader reader = new MultiFormatReader();
reader.setHints(hints);
return new Decoder(reader);
}
/**
* Decode a binary bitmap.
*
* @param bitmap the binary bitmap
* @return a Result or null
*/
protected Result decode(BinaryBitmap bitmap) {
possibleResultPoints.clear();
try {
if (reader instanceof MultiFormatReader) {
// Optimization - MultiFormatReader's normal decode() method is slow.
return ((MultiFormatReader) reader).decodeWithState(bitmap);
} else {
return reader.decode(bitmap);
}
} catch (Exception e) {
// Decode error, try again next frame
return null;
} finally {
reader.reset();
}
}
public String decodeWithZxing(byte[] data, int width, int height, Rect crop) {
MultiFormatReader multiFormatReader = new MultiFormatReader();
multiFormatReader.setHints(changeZXingDecodeDataMode());
Result rawResult = null;
PlanarYUVLuminanceSource source = new PlanarYUVLuminanceSource(data, width, height,
crop.left, crop.top, crop.width(), crop.height(), false);
if (source != null) {
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
try {
rawResult = multiFormatReader.decodeWithState(bitmap);
} catch (ReaderException re) {
// continue
} finally {
multiFormatReader.reset();
}
}
return rawResult != null ? rawResult.getText() : null;
}
public String decodeWithZxing(Bitmap bitmap) {
MultiFormatReader multiFormatReader = new MultiFormatReader();
multiFormatReader.setHints(changeZXingDecodeDataMode());
int width = bitmap.getWidth();
int height = bitmap.getHeight();
int[] pixels = new int[width * height];
bitmap.getPixels(pixels, 0, width, 0, 0, width, height);
Result rawResult = null;
RGBLuminanceSource source = new RGBLuminanceSource(width, height, pixels);
if (source != null) {
BinaryBitmap binaryBitmap = new BinaryBitmap(new HybridBinarizer(source));
try {
rawResult = multiFormatReader.decodeWithState(binaryBitmap);
} catch (ReaderException re) {
// continue
} finally {
multiFormatReader.reset();
}
}
return rawResult != null ? rawResult.getText() : null;
}
public QRCodeCameraDecode(CameraManager cameraManager,ResultPointCallback resultPointCallback){
this.mCameraManger = cameraManager;
hints = new Hashtable<>(3);
Vector<BarcodeFormat> decodeFormats = new Vector<>();
decodeFormats.addAll(QRCodeDecodeFormat.ONE_D_FORMATS);
decodeFormats.addAll(QRCodeDecodeFormat.QR_CODE_FORMATS);
decodeFormats.addAll(QRCodeDecodeFormat.DATA_MATRIX_FORMATS);
decodeFormats.addAll(QRCodeDecodeFormat.PRODUCT_FORMATS);
hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);
if (resultPointCallback != null) {
hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, resultPointCallback);
}
multiFormatReader = new MultiFormatReader();
multiFormatReader.setHints(hints);
}
/**
* 使用RGB解析bitmap
*
* @param data
* @param width
* @param height
* @param hintTypeMap
* @return
*/
private Result decodeFromRGB(int[] data, int width, int height, Map<DecodeHintType, ?> hintTypeMap) {
RGBLuminanceSource source = new RGBLuminanceSource(width, height, data);
BinaryBitmap binaryBitmap = new BinaryBitmap(new HybridBinarizer(source));
try {
return new MultiFormatReader().decode(binaryBitmap, hintTypeMap);
} catch (NotFoundException e) {
e.printStackTrace();
}
return null;
}
/**
* 解析二维码图片
* @param bitmap 待解析的二维码图片
* @param qrScanCallBack 解析结果回调
*/
public static void decodeQRCode(final Bitmap bitmap, final QRScanCallBack qrScanCallBack) {
if (bitmap == null) {
if (qrScanCallBack != null) {
qrScanCallBack.onResult(false, null, new Exception("bitmap is null"));
}
return;
}
// 开始解析
DevThreadManager.getInstance(5).execute(new Runnable() {
@Override
public void run() {
try {
int width = bitmap.getWidth();
int height = bitmap.getHeight();
int[] pixels = new int[width * height];
bitmap.getPixels(pixels, 0, width, 0, 0, width, height);
RGBLuminanceSource source = new RGBLuminanceSource(width, height, pixels);
Result result = new MultiFormatReader().decode(new BinaryBitmap(new HybridBinarizer(source)), DECODE_HINTS);
// 触发回调
if (qrScanCallBack != null) {
qrScanCallBack.onResult((result != null), result, null);
}
} catch (Exception e) {
LogPrintUtils.eTag(TAG, e, "decodeQRCode");
// 触发回调
if (qrScanCallBack != null) {
qrScanCallBack.onResult(false, null, e);
}
}
}
});
}
public String parse(InputStream imageStream) {
final Bitmap bMap = BitmapFactory.decodeStream(imageStream);
String contents = null;
int[] intArray = new int[bMap.getWidth()*bMap.getHeight()];
bMap.getPixels(intArray, 0, bMap.getWidth(), 0, 0, bMap.getWidth(), bMap.getHeight());
LuminanceSource source = new RGBLuminanceSource(bMap.getWidth(), bMap.getHeight(), intArray);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
Map<DecodeHintType, Object> tmpHintsMap = new EnumMap<DecodeHintType, Object>(
DecodeHintType.class);
tmpHintsMap.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
tmpHintsMap.put(DecodeHintType.POSSIBLE_FORMATS,
EnumSet.allOf(BarcodeFormat.class));
tmpHintsMap.put(DecodeHintType.PURE_BARCODE, Boolean.FALSE);
Reader reader = new MultiFormatReader();
Result result = null;
try {
result = reader.decode(bitmap, tmpHintsMap);
contents = result.getText();
} catch (NotFoundException | ChecksumException | FormatException e) {
e.printStackTrace();
}
return contents;
}
@Override
public void run() {
try {
if (!webCam.isOpen())
webCam.open();
isRunning = true;
Result result;
BufferedImage bufferedImage;
while (isRunning) {
bufferedImage = webCam.getImage();
if (bufferedImage != null) {
WritableImage writableImage = SwingFXUtils.toFXImage(bufferedImage, null);
imageView.setImage(writableImage);
imageView.setRotationAxis(new Point3D(0.0, 1.0, 0.0));
imageView.setRotate(180.0);
LuminanceSource source = new BufferedImageLuminanceSource(bufferedImage);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
try {
result = new MultiFormatReader().decode(bitmap);
isRunning = false;
String qrCode = result.getText();
UserThread.execute(() -> resultHandler.accept(qrCode));
} catch (NotFoundException ignore) {
// No qr code in image...
}
}
}
} catch (Throwable t) {
log.error(t.toString());
} finally {
webCam.close();
}
}
DecodeHandler(ActivityScanerCode activity) {
multiFormatReader = new MultiFormatReader();
// 解码的参数
Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>(2);
// 可以解析的编码类型
Vector<BarcodeFormat> decodeFormats = new Vector<BarcodeFormat>();
if (decodeFormats == null || decodeFormats.isEmpty()) {
decodeFormats = new Vector<BarcodeFormat>();
Vector<BarcodeFormat> PRODUCT_FORMATS = new Vector<BarcodeFormat>(5);
PRODUCT_FORMATS.add(BarcodeFormat.UPC_A);
PRODUCT_FORMATS.add(BarcodeFormat.UPC_E);
PRODUCT_FORMATS.add(BarcodeFormat.EAN_13);
PRODUCT_FORMATS.add(BarcodeFormat.EAN_8);
// PRODUCT_FORMATS.add(BarcodeFormat.RSS14);
Vector<BarcodeFormat> ONE_D_FORMATS = new Vector<BarcodeFormat>(PRODUCT_FORMATS.size() + 4);
ONE_D_FORMATS.addAll(PRODUCT_FORMATS);
ONE_D_FORMATS.add(BarcodeFormat.CODE_39);
ONE_D_FORMATS.add(BarcodeFormat.CODE_93);
ONE_D_FORMATS.add(BarcodeFormat.CODE_128);
ONE_D_FORMATS.add(BarcodeFormat.ITF);
Vector<BarcodeFormat> QR_CODE_FORMATS = new Vector<BarcodeFormat>(1);
QR_CODE_FORMATS.add(BarcodeFormat.QR_CODE);
Vector<BarcodeFormat> DATA_MATRIX_FORMATS = new Vector<BarcodeFormat>(1);
DATA_MATRIX_FORMATS.add(BarcodeFormat.DATA_MATRIX);
// 这里设置可扫描的类型,我这里选择了都支持
decodeFormats.addAll(ONE_D_FORMATS);
decodeFormats.addAll(QR_CODE_FORMATS);
decodeFormats.addAll(DATA_MATRIX_FORMATS);
}
hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);
multiFormatReader.setHints(hints);
this.activity = activity;
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK && requestCode == REQUEST_SELECT_PICTURE) {
final Uri selectedUri = data.getData();
if (selectedUri != null) {
try {
Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), selectedUri);
if (bitmap != null) {
int width = bitmap.getWidth();
int height = bitmap.getHeight();
int[] dataArr = new int[width * height];
bitmap.getPixels(dataArr, 0, width, 0, 0, width, height);
Decoder decoder = new Decoder(new MultiFormatReader());
Result result = decoder.decode(new RGBLuminanceSource(width, height, dataArr));
if (result != null) {
BrowserActivity.start(this, result.getText());
} else {
SnackbarUtil.show(this, "这个码真扫不了");
}
bitmap.recycle();
} else {
SnackbarUtil.show(this, "这个码真扫不了");
}
} catch (Exception e) {
SnackbarUtil.show(this, "这个码真扫不了");
}
} else {
SnackbarUtil.show(this, "这个码真扫不了");
}
}
}
@NonNull
private static MultiFormatReader createReader(@Nullable final Map<DecodeHintType, ?> hints) {
final MultiFormatReader reader = new MultiFormatReader();
if (hints != null) {
reader.setHints(hints);
} else {
reader.setHints(Collections
.singletonMap(DecodeHintType.POSSIBLE_FORMATS, CodeScanner.ALL_FORMATS));
}
return reader;
}
@Nullable
public static Result decodeLuminanceSource(@NonNull final MultiFormatReader reader,
@NonNull final LuminanceSource luminanceSource) throws ReaderException {
try {
return reader.decodeWithState(new BinaryBitmap(new HybridBinarizer(luminanceSource)));
} catch (final NotFoundException e) {
return reader.decodeWithState(
new BinaryBitmap(new HybridBinarizer(luminanceSource.invert())));
} finally {
reader.reset();
}
}
DecodeHandler(ScannerActivity activity) {
this.mActivity = activity;
mMultiFormatReader = new MultiFormatReader();
mHints = new Hashtable<>();
mHints.put(DecodeHintType.CHARACTER_SET, "utf-8");
mHints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
Collection<BarcodeFormat> barcodeFormats = new ArrayList<>();
barcodeFormats.add(BarcodeFormat.CODE_39);
barcodeFormats.add(BarcodeFormat.CODE_128); // 快递单常用格式39,128
barcodeFormats.add(BarcodeFormat.QR_CODE); //扫描格式自行添加
mHints.put(DecodeHintType.POSSIBLE_FORMATS, barcodeFormats);
}
public ZXDecoder()
{
reader = new MultiFormatReader();
hints.put(DecodeHintType.POSSIBLE_FORMATS, EnumSet.allOf(BarcodeFormat.class));
hints.put(DecodeHintType.CHARACTER_SET, "utf-8");
hints.put(DecodeHintType.TRY_HARDER, true);
reader.setHints(hints);
}
DecodeHandler(QrCodeActivity activity) {
this.mActivity = activity;
mMultiFormatReader = new MultiFormatReader();
mHints = new Hashtable<>();
mHints.put(DecodeHintType.CHARACTER_SET, "utf-8");
mHints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
Collection<BarcodeFormat> barcodeFormats = new ArrayList<>();
barcodeFormats.add(BarcodeFormat.QR_CODE);
barcodeFormats.add(BarcodeFormat.CODE_39);
barcodeFormats.add(BarcodeFormat.CODE_93);
barcodeFormats.add(BarcodeFormat.CODE_128);
mHints.put(DecodeHintType.POSSIBLE_FORMATS, barcodeFormats);
}
public static void analyzeBitmap(Bitmap bitmap, AnalyzeCallback analyzeCallback) {
MultiFormatReader multiFormatReader = new MultiFormatReader();
// 解码的参数
Hashtable<DecodeHintType, Object> hints = new Hashtable<>(2);
// 可以解析的编码类型
Vector<BarcodeFormat> decodeFormats = new Vector<>();
// 这里设置可扫描的类型,我这里选择了都支持
decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);
// 设置继续的字符编码格式为UTF8
// hints.put(DecodeHintType.CHARACTER_SET, "UTF8");
// 设置解析配置参数
multiFormatReader.setHints(hints);
// 开始对图像资源解码
Result rawResult = null;
try {
rawResult = multiFormatReader.decodeWithState(
new BinaryBitmap(new HybridBinarizer(new BitmapLuminanceSource(bitmap))));
} catch (Exception e) {
e.printStackTrace();
}
if (rawResult != null) {
if (analyzeCallback != null) {
analyzeCallback.onAnalyzeSuccess(bitmap, rawResult.getText());
}
} else {
if (analyzeCallback != null) {
analyzeCallback.onAnalyzeFailed();
}
}
}
public static String decode(File file) throws Exception {
BufferedImage image;
image = ImageIO.read(file);
if (image == null) {
return null;
}
BufferedImageLuminanceSource source = new BufferedImageLuminanceSource(image);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
Result result;
Hashtable<DecodeHintType,Object> hints = new Hashtable<>();
hints.put(DecodeHintType.CHARACTER_SET, CHARSET);
result = new MultiFormatReader().decode(bitmap, hints);
String resultStr = result.getText();
return resultStr;
}
/**
* 解析QRCode二维码
*/
@SuppressWarnings("unchecked")
public static void decode(File file) {
try {
BufferedImage image;
try {
image = ImageIO.read(file);
if (image == null) {
System.out.println("Could not decode image");
}
LuminanceSource source = new BufferedImageLuminanceSource(image);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
Result result;
@SuppressWarnings("rawtypes")
Hashtable hints = new Hashtable();
//解码设置编码方式为:utf-8
hints.put(DecodeHintType.CHARACTER_SET, "utf-8");
result = new MultiFormatReader().decode(bitmap, hints);
String resultStr = result.getText();
System.out.println("解析后内容:" + resultStr);
} catch (IOException ioe) {
System.out.println(ioe.toString());
} catch (ReaderException re) {
System.out.println(re.toString());
}
} catch (Exception ex) {
System.out.println(ex.toString());
}
}
private QRCodeDecode(Builder builder) {
mMultiFormatReader = new MultiFormatReader();
Map<DecodeHintType, Object> hints = new EnumMap<>(DecodeHintType.class);
Collection<BarcodeFormat> formats = new ArrayList<>();
formats.add(BarcodeFormat.QR_CODE);
hints.put(DecodeHintType.POSSIBLE_FORMATS, formats);
hints.put(DecodeHintType.CHARACTER_SET, builder.mCharset);
mMultiFormatReader.setHints(hints);
}
DecodeHandler(CaptureActivity activity, Hashtable<DecodeHintType, Object> hints) {
multiFormatReader = new MultiFormatReader();
multiFormatReader.setHints(hints);
this.activity = activity;
}