[英]How to find scanned image is QR or Barcode?
Hi How to get scanned image is barcode or QR? 嗨,如何获取扫描图像是条形码还是QR? Here is my code where I can get only product id but i couldn't get scanned format name.
这是我的代码,我只能获取产品ID,但无法获取扫描格式的名称。 How to solve this.
如何解决这个问题。 Please me to solve this.
请我解决这个问题。
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import com.contus.sportscorner.utils.Constants;
import com.google.zxing.Result;
import com.google.zxing.client.android.CaptureActivity;
public class ScannerActivity extends CaptureActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.barcode_scan);
}
@Override
public void handleDecode(Result rawResult, Bitmap barcode) {
String productId = rawResult.getText();
Intent intent = new Intent(ScannerActivity.this, NextAcitivity.class);
intent.putExtra(Constants.ID, productId); // i am getting just product
// id
startActivity(intent);
finish();
}
} }
Use this. 用这个。
String barcodeType = rawResult.getBarcodeFormat().toString(); 字符串条形码类型= rawResult.getBarcodeFormat()。toString();
First you should be converted into string then compare these values 首先,您应该将其转换为字符串,然后比较这些值
how to convert in to string 如何转换成字符串
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.