我使用 ZXing 库进行条码扫描。
我在我的项目中使用 2 类 ZXing,IntentIntegrator.java 和 IntentResult.java。
我可以很容易地从条形码图像中获取代码,并从下面的代码中获取条形码图像的格式,
public void onClick(View view)
{
IntentIntegrator integrator = new IntentIntegrator(this);
integrator.initiateScan();
}
public void onActivityResult(int requestCode, int resultCode, Intent intent)
{
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if (scanResult != null)
{
String barcode;
String format;
barcode=scanResult.getContents();
format=scanResult.getFormatName();
}
}
现在,我的问题是如何获取条形码的类型,如文本、URL、地址簿、电话号码、电子邮件地址。
我需要你们的帮助,请帮助!
提前致谢。