【发布时间】:2018-11-12 11:01:24
【问题描述】:
**这是我的代码,我想要的是在第一次调用 callApi() 方法后扫描,但它会继续扫描**
@Override
public void handleResult(Result result) {
System.out.print("BAR_CODE "+ result.getContents());
System.out.print("BAR_CODEE "+result.getBarcodeFormat().getName());
barcode_number = result.getContents();
productcode.setText(result.getContents());
//resume Camera
scanner_bar.resumeCameraPreview(this);
dialog = new ProgressDialog(getActivity());
dialog.setCancelable(true);
dialog.setTitle("Loading");
dialog.show();
//callApi
if(barcode_number != "") {
callApi(barcode_number);
}
};
【问题讨论】:
-
您需要暂停或停止相机预览。
-
@Zaheer 可以加zbar Gradle或者github链接
-
@Zaheer 我在我的应用程序上使用 zxing 扫描仪,如果您需要,我可以帮助您实现。
-
我以前用过zxing,但是扫描速度很慢,@Abhishekkumar
-
@SaurabhBhandari 谢谢你,先生,它对我有用。 scanner_bar.stopCamera()