當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。