mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-05-18 21:58:52 -04:00
Fix for 'Crash on clicking "Add from image" button in scan activity #856'
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,4 +285,5 @@
|
||||
<string name="archiveList">Archive</string>
|
||||
<string name="overflowMenu" translatable="false">Overflow menu</string>
|
||||
<string name="noUnarchivedCardsMessage">No unarchived cards exist</string>
|
||||
<string name="failedLaunchingPhotoPicker">Could not find a supported gallery app</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user