You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when the user clicks the back button on the barcode scanning screen, the onKeyDown (in CaptureActivity) will react to it and the activity will be closed.
But the next Activity will capture the onBackPressed event, therefore it will be closed as well.
So with one back click, 2 Activity are closed.
With this modification we get the expected result:
So we handle the exit on the onBackPressed and not on the onKeyDown:
@OverRide
public void onBackPressed() {
if (source == IntentSource.NATIVE_APP_INTENT) {
setResult(RESULT_CANCELED);
finish();
}
if ((source == IntentSource.NONE || source == IntentSource.ZXING_LINK) && lastResult != null) {
restartPreviewAfterDelay(0L);
}
super.onBackPressed();
}
@OverRide
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) {
/* case KeyEvent.KEYCODE_BACK:
if (source == IntentSource.NATIVE_APP_INTENT) {
setResult(RESULT_CANCELED);
finish();
return true;
}
if ((source == IntentSource.NONE || source == IntentSource.ZXING_LINK) && lastResult != null) {
restartPreviewAfterDelay(0L);
return true;
}
break;*/
case KeyEvent.KEYCODE_FOCUS:
The text was updated successfully, but these errors were encountered:
Hi Folks,
when the user clicks the back button on the barcode scanning screen, the onKeyDown (in CaptureActivity) will react to it and the activity will be closed.
But the next Activity will capture the onBackPressed event, therefore it will be closed as well.
So with one back click, 2 Activity are closed.
With this modification we get the expected result:
So we handle the exit on the onBackPressed and not on the onKeyDown:
@OverRide
public void onBackPressed() {
if (source == IntentSource.NATIVE_APP_INTENT) {
setResult(RESULT_CANCELED);
finish();
}
if ((source == IntentSource.NONE || source == IntentSource.ZXING_LINK) && lastResult != null) {
restartPreviewAfterDelay(0L);
}
super.onBackPressed();
}
@OverRide
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) {
/* case KeyEvent.KEYCODE_BACK:
if (source == IntentSource.NATIVE_APP_INTENT) {
setResult(RESULT_CANCELED);
finish();
return true;
}
if ((source == IntentSource.NONE || source == IntentSource.ZXING_LINK) && lastResult != null) {
restartPreviewAfterDelay(0L);
return true;
}
break;*/
case KeyEvent.KEYCODE_FOCUS:
The text was updated successfully, but these errors were encountered: