catch security exception when viewing file from media preview

This commit is contained in:
Daniel Gultsch 2021-09-10 18:46:37 +02:00
parent d436c5f856
commit 25f137441b

View file

@ -75,8 +75,10 @@ public class MediaPreviewAdapter extends RecyclerView.Adapter<MediaPreviewAdapte
view.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); view.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
try { try {
context.startActivity(view); context.startActivity(view);
} catch (ActivityNotFoundException e) { } catch (final ActivityNotFoundException e) {
Toast.makeText(context, R.string.no_application_found_to_open_file, Toast.LENGTH_SHORT).show(); Toast.makeText(context, R.string.no_application_found_to_open_file, Toast.LENGTH_SHORT).show();
} catch (final SecurityException e) {
Toast.makeText(context, R.string.sharing_application_not_grant_permission, Toast.LENGTH_SHORT).show();
} }
} }