How to read multiple scan using zxing library in android -
this code scan single record return app. how scan multiple record without returning back.
intent intentscan = new intent("com.google.zxing.client.android.scan"); intentscan.addcategory(intent.category_default);
string targetapppackage = findtargetapppackage(intentscan); if (targetapppackage == null) { return showdownloaddialog(); } intentscan.setpackage(targetapppackage); intentscan.addflags(intent.flag_activity_clear_top); intentscan.addflags(intent.flag_activity_clear_when_task_reset); attachmoreextras(intentscan); startactivityforresult(intentscan, 0);
update onactivityresult method this
//method getting qr code qr code after scan public void onactivityresult(int requestcode, int resultcode, intent intent) { if (requestcode == 0) { if (resultcode == result_ok) { string contents = intent.getstringextra("scan_result"); toast.maketext(this, contents , toast.length_short).show(); //start activity scanning qr code intent intent = new intent("com.google.zxing.client.android.scan"); intent.putextra("scan_mode", "qr_code_mode"); startactivityforresult(intent, 0); // handle successful scan } else if (resultcode == result_canceled) { // handle cancel log.d("the result is","not ok"); } }
Comments
Post a Comment