I read there is a key to enable bulk mode scan in zxing. May I know how do i enable this key in an android application?
I am currently using such codes to scan a bar
There is no concept of "bulk mode" within zxing I don't think.
You can certainly implement the behavior that you are looking for though with zxing inside your own application. Use the code that you already have in your question to kick of Scanning for the first time. Add this declaration to your class:
ArrayList<String> results;
Then add this inside onCreate before you start scanning to initialize it:
results = new ArrayList<String>();
Inside your onActivityResult() you can add the current result to your ArrayList and then start the next scan.
/*Here is where we come back after the Barcode Scanner is done*/
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
// contents contains whatever the code was
String contents = intent.getStringExtra("SCAN_RESULT");
// Format contains the type of code i.e. UPC, EAN, QRCode etc...
String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
// Handle successful scan. In this example add contents to ArrayList
results.add(contents);
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_FORMATS", "PRODUCT_MODE,CODE_39,CODE_93,CODE_128,DATA_MATRIX,ITF");
startActivityForResult(intent, 0); // start the next scan
} else if (resultCode == RESULT_CANCELED) {
// User hass pressed 'back' instead of scanning. They are done.
saveToCSV(results);
//do whatever else you want.
}
}
}
Saving them to a CSV file is beyond the scope of this specific question, but If you look around you can find examples of how to do it. Consider it left blank as an exercise for you to learn from.