2014年12月4日 星期四

Android barcode scanner 使用Zxing 連續掃程式碼

/*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) {掃

            // 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.
        }
    }
}

沒有留言:

張貼留言