diff --git a/app/src/main/java/protect/card_locker/LoyaltyCardEditActivity.java b/app/src/main/java/protect/card_locker/LoyaltyCardEditActivity.java
index 35252b399..d10343326 100644
--- a/app/src/main/java/protect/card_locker/LoyaltyCardEditActivity.java
+++ b/app/src/main/java/protect/card_locker/LoyaltyCardEditActivity.java
@@ -5,6 +5,7 @@ import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.DatePickerDialog;
import android.app.Dialog;
+import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
@@ -1171,7 +1172,14 @@ public class LoyaltyCardEditActivity extends CatimaAppCompatActivity {
Intent i = new Intent(Intent.ACTION_PICK);
i.setType("image/*");
- mPhotoPickerLauncher.launch(i);
+
+ try {
+ mPhotoPickerLauncher.launch(i);
+ } catch (ActivityNotFoundException e) {
+ Toast.makeText(getApplicationContext(), R.string.failedLaunchingPhotoPicker, Toast.LENGTH_LONG).show();
+ Log.e(TAG, "No activity found to handle intent", e);
+ }
+
return null;
});
diff --git a/app/src/main/java/protect/card_locker/ScanActivity.java b/app/src/main/java/protect/card_locker/ScanActivity.java
index da2d7c763..a5a7df2d9 100644
--- a/app/src/main/java/protect/card_locker/ScanActivity.java
+++ b/app/src/main/java/protect/card_locker/ScanActivity.java
@@ -1,6 +1,7 @@
package protect.card_locker;
import android.app.Activity;
+import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
@@ -206,6 +207,11 @@ public class ScanActivity extends CatimaAppCompatActivity {
public void addFromImage(View view) {
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
photoPickerIntent.setType("image/*");
- photoPickerLauncher.launch(photoPickerIntent);
+ try {
+ photoPickerLauncher.launch(photoPickerIntent);
+ } catch (ActivityNotFoundException e) {
+ Toast.makeText(getApplicationContext(), R.string.failedLaunchingPhotoPicker, Toast.LENGTH_LONG).show();
+ Log.e(TAG, "No activity found to handle intent", e);
+ }
}
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index fd90c8e56..f6a77fa0d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -285,4 +285,5 @@
Archive
Overflow menu
No unarchived cards exist
+ Could not find a supported gallery app
\ No newline at end of file