From ef532393e4cc884629a92164f1e8bd4f0bce2a82 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste <87148630+Jean-BaptisteC@users.noreply.github.com> Date: Fri, 29 Mar 2024 16:04:37 +0100 Subject: [PATCH] Add onBackPressed method to do not generate crash (#29) --- .../java/net/foucry/pilldroid/CustomScannerActivity.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/net/foucry/pilldroid/CustomScannerActivity.java b/app/src/main/java/net/foucry/pilldroid/CustomScannerActivity.java index 1a0a0c6..5acf261 100644 --- a/app/src/main/java/net/foucry/pilldroid/CustomScannerActivity.java +++ b/app/src/main/java/net/foucry/pilldroid/CustomScannerActivity.java @@ -88,6 +88,11 @@ public class CustomScannerActivity extends Activity implements DecoratedBarcodeV capture.onDestroy(); } + @Override + public void onBackPressed(){ + onCancel(this.getCurrentFocus()); + } + @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState);