当前位置: 首页>>代码示例>>Java>>正文


Java Result.getText方法代码示例

本文整理汇总了Java中com.google.zxing.Result.getText方法的典型用法代码示例。如果您正苦于以下问题:Java Result.getText方法的具体用法?Java Result.getText怎么用?Java Result.getText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.zxing.Result的用法示例。


在下文中一共展示了Result.getText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: translateResultPoints

import com.google.zxing.Result; //导入方法依赖的package包/类
private static Result translateResultPoints(Result result, int xOffset, int yOffset) {
  ResultPoint[] oldResultPoints = result.getResultPoints();
  if (oldResultPoints == null) {
    return result;
  }
  ResultPoint[] newResultPoints = new ResultPoint[oldResultPoints.length];
  for (int i = 0; i < oldResultPoints.length; i++) {
    ResultPoint oldPoint = oldResultPoints[i];
    if (oldPoint != null) {
      newResultPoints[i] = new ResultPoint(oldPoint.getX() + xOffset, oldPoint.getY() + yOffset);
    }
  }
  Result newResult = new Result(result.getText(),
                                result.getRawBytes(),
                                result.getNumBits(),
                                newResultPoints,
                                result.getBarcodeFormat(),
                                result.getTimestamp());
  newResult.putAllMetadata(result.getResultMetadata());
  return newResult;
}
 
开发者ID:simplezhli,项目名称:Tesseract-OCR-Scanner,代码行数:22,代码来源:GenericMultipleBarcodeReader.java

示例2: handleDecode

import com.google.zxing.Result; //导入方法依赖的package包/类
/**
 * Handler scan result
 * @param result
 * @param barcode
 */
public void handleDecode(Result result, Bitmap barcode) {
	inactivityTimer.onActivity();
	playBeepSoundAndVibrate();
	String resultString = result.getText();
	if (resultString.equals("")) {
		Toast.makeText(CaptureActivity.this, "Scan failed!", Toast.LENGTH_SHORT).show();
	}else {
		Intent resultIntent = new Intent();
		Bundle bundle = new Bundle();
		bundle.putString("result", resultString);
		bundle.putParcelable("bitmap", barcode);
		resultIntent.putExtras(bundle);
		this.setResult(RESULT_OK, resultIntent);
	}
	CaptureActivity.this.finish();
}
 
开发者ID:CoderCF,项目名称:ZXingDemo,代码行数:22,代码来源:CaptureActivity.java

示例3: decode

import com.google.zxing.Result; //导入方法依赖的package包/类
/**
 * 解析二维码
 *
 * @param file 二维码图片
 * @return
 * @throws Exception
 */
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<DecodeHintType, Object>();
	hints.put(DecodeHintType.CHARACTER_SET, CHARSET);
	result = new MultiFormatReader().decode(bitmap, hints);
	String resultStr = result.getText();
	return resultStr;
}
 
开发者ID:funtl,项目名称:framework,代码行数:23,代码来源:QRCodeUtils.java

示例4: decode

import com.google.zxing.Result; //导入方法依赖的package包/类
public static String decode(File file) throws Exception {
    BufferedImage image;
    image = ImageIO.read(file);
    if (image == null) {
        return null;
    }
    CodeImage source = new CodeImage(
            image);
    BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
    Result result;
    Hashtable hints = new Hashtable();
    hints.put(DecodeHintType.CHARACTER_SET, CHARSET);
    result = new MultiFormatReader().decode(bitmap, hints);
    String resultStr = result.getText();
    return resultStr;
}
 
开发者ID:Fetax,项目名称:Fetax-AI,代码行数:17,代码来源:CodeUtil.java

示例5: syncDecodeQRCode

import com.google.zxing.Result; //导入方法依赖的package包/类
/**
 * 同步解析bitmap二维码。该方法是耗时操作,请在子线程中调用。
 *
 * @param bitmap 要解析的二维码图片
 * @return 返回二维码图片里的内容 或 null
 */
public static String syncDecodeQRCode(Bitmap bitmap) {
    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)), HINTS);
        return result.getText();
    } catch (Exception e) {
        return null;
    }
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:20,代码来源:QRCodeDecoder.java

示例6: handleResult

import com.google.zxing.Result; //导入方法依赖的package包/类
@Override
public void handleResult(Result result) {
    if (result == null) return;
    String address = result.getText();
    try {
        AddressEncoder scanned = AddressEncoder.decode(address);
        Intent data = new Intent();
        data.putExtra("ADDRESS", scanned.getAddress().toLowerCase());

        if (scanned.getAddress().length() > 42 && !scanned.getAddress().startsWith("0x") && scanned.getAmount() == null)
            type = PRIVATE_KEY;

        if (scanned.getAmount() != null) {
            data.putExtra("AMOUNT", scanned.getAmount());
            type = REQUEST_PAYMENT;
        }

        data.putExtra("TYPE", type);
        setResult(RESULT_OK, data);
        finish();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:manuelsc,项目名称:Lunary-Ethereum-Wallet,代码行数:25,代码来源:QRScanActivity.java

示例7: translateResultPoints

import com.google.zxing.Result; //导入方法依赖的package包/类
private static Result translateResultPoints(Result result, int xOffset, int yOffset) {
  ResultPoint[] oldResultPoints = result.getResultPoints();
  if (oldResultPoints == null) {
    return result;
  }
  ResultPoint[] newResultPoints = new ResultPoint[oldResultPoints.length];
  for (int i = 0; i < oldResultPoints.length; i++) {
    ResultPoint oldPoint = oldResultPoints[i];
    if (oldPoint != null) {
      newResultPoints[i] = new ResultPoint(oldPoint.getX() + xOffset, oldPoint.getY() + yOffset);
    }
  }
  Result newResult = new Result(result.getText(), result.getRawBytes(), newResultPoints, result.getBarcodeFormat());
  newResult.putAllMetadata(result.getResultMetadata());
  return newResult;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:17,代码来源:GenericMultipleBarcodeReader.java

示例8: decodes

import com.google.zxing.Result; //导入方法依赖的package包/类
/**
* 解析条形码
*/
  public static String decodes(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;
  }
 
开发者ID:Awesky,项目名称:awe-awesomesky,代码行数:22,代码来源:CodeUtil.java

示例9: handleDecode

import com.google.zxing.Result; //导入方法依赖的package包/类
/**
 * Handler scan result
 * @param result
 * @param barcode
 */
public void handleDecode(Result result, Bitmap barcode) {
	inactivityTimer.onActivity();
	playBeepSoundAndVibrate();
	String resultString = result.getText();
	//FIXME
	if (resultString.equals("")) {
		Toast.makeText(CaptureActivity.this, "Scan failed!", Toast.LENGTH_SHORT).show();
	}

	setResult(RESULT_OK, new Intent().putExtra(RESULT_QRCODE_STRING, resultString));
	finish();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:CaptureActivity.java

示例10: main

import com.google.zxing.Result; //导入方法依赖的package包/类
public static void main(String[] args) {
	String saveImgFilePath = "D://zxing.png";
	Boolean encode = encode("我是Javen205", BarcodeFormat.QR_CODE, 3, ErrorCorrectionLevel.H, "png", 200, 200,
			saveImgFilePath);
	if (encode) {
		Result result = decode(saveImgFilePath);
		String text = result.getText();
		System.out.println(text);
	}
}
 
开发者ID:Javen205,项目名称:IJPay,代码行数:11,代码来源:ZxingKit.java

示例11: handleResult

import com.google.zxing.Result; //导入方法依赖的package包/类
@Override
public void handleResult(Result rawResult) {
    if (config.getCamera()) {
        qrView.resumeCameraPreview(this);
    }
    String s = rawResult.getText();
    if (s.equals(lastScanCode) && System.currentTimeMillis() - lastScanTime < 5000) {
        return;
    }
    lastScanTime = System.currentTimeMillis();
    lastScanCode = s;

    handleScan(s);
}
 
开发者ID:c3cashdesk,项目名称:postixdroid,代码行数:15,代码来源:MainActivity.java

示例12: handleResult

import com.google.zxing.Result; //导入方法依赖的package包/类
@Override
public void handleResult(Result result) {
    Intent i = new Intent(ActivityEscaner.this, ActivityRegistrarProducto.class);
    i.putExtra("barcode", result.getText());
    barCode = result.getText();
    escanerView.stopCamera();
    startActivity(i);
    this.finish();
}
 
开发者ID:EdwardAlexis,项目名称:Sistema-de-Comercializacion-Negocios-Jhordan,代码行数:10,代码来源:ActivityEscaner.java

示例13: maybeReturnResult

import com.google.zxing.Result; //导入方法依赖的package包/类
private static Result maybeReturnResult(Result result) throws FormatException {
    String text = result.getText();
    if (text.charAt(0) == '0') {
        return new Result(text.substring(1), null, result.getResultPoints(), BarcodeFormat
                .UPC_A);
    }
    throw FormatException.getFormatInstance();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:UPCAReader.java

示例14: handleDecode

import com.google.zxing.Result; //导入方法依赖的package包/类
/**
 * Handler scan result
 *
 * @param result
 * @param barcode
 */
public void handleDecode(Result result, Bitmap barcode) {
    inactivityTimer.onActivity();
    playBeepSoundAndVibrate();
    String resultString = result.getText();
    handleResult(resultString);
}
 
开发者ID:yiwent,项目名称:Mobike,代码行数:13,代码来源:CaptureActivity.java

示例15: maybeReturnResult

import com.google.zxing.Result; //导入方法依赖的package包/类
private static Result maybeReturnResult(Result result) throws FormatException {
  String text = result.getText();
  if (text.charAt(0) == '0') {
    return new Result(text.substring(1), null, result.getResultPoints(), BarcodeFormat.UPC_A);
  } else {
    throw FormatException.getFormatInstance();
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:9,代码来源:UPCAReader.java


注:本文中的com.google.zxing.Result.getText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。