I have a problem with ZXing activities : When a scan succeeds, it works properly, goes back to parent activity, sets the result in the textfield, but calls the onCreate method of its parent which is very problematic for me.
Here is my result listener :
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if(resultCode == RESULT_OK) {
if (scanResult != null) {
String ean = scanResult.getContents();
eanEdit.setText(ean);
}
} else {
// Nothing
}
}
The button listener :
public void addScanButtonListener() {
scanButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
IntentIntegrator integrator = new IntentIntegrator(MainActivity.this);
integrator.addExtra("SCAN_WIDTH", 800);
integrator.addExtra("SCAN_HEIGHT", 200);
integrator.addExtra("RESULT_DISPLAY_DURATION_MS", 0L);
integrator.addExtra("SCAN_FORMATS", "EAN_13,EAN_8");
integrator.addExtra("SAVE_HISTORY", false);
integrator.addExtra("PROMPT_MESSAGE", "Scan please");
integrator.initiateScan(IntentIntegrator.PRODUCT_CODE_TYPES);
}
});
}
Would you have any clue ?