I have successfully integrated ZXing QR Scanner. What I am doing is to repeat the scan once the user has finished scanning 1 QR code. The problem I faced is that ZXing is extremely slow in reloading of camera if I do multiple scanning of QR codes through this method. Are there better ways? I am looking at saving all the scans without the camera reloading (turning off and on).
我只是在扫描我自己的定制的QR代码,因此我不需要处理其他格式。
Scanning
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);
检索
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
String contents = intent.getStringExtra("SCAN_RESULT");
String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
// Handle successful scan
//..
//Repeat scan for next QR code
Intent i = new Intent("com.google.zxing.client.android.SCAN");
i.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(i, 0);
}
else {
// Handle cancel
//...
}
}