Skip to content

Commit

Permalink
Fix: Activity Not found exception in MultimediaImageFragment
Browse files Browse the repository at this point in the history
  • Loading branch information
criticalAY committed Nov 8, 2024
1 parent edd1c61 commit 0549ea1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package com.ichi2.anki.multimedia

import android.app.Activity
import android.content.ActivityNotFoundException
import android.content.Context
import android.content.Intent
import android.graphics.Bitmap
Expand Down Expand Up @@ -325,7 +326,12 @@ class MultimediaImageFragment : MultimediaFragment(R.layout.fragment_multimedia_

private fun openGallery() {
val intent = Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI)
pickImageLauncher.launch(intent)
try {
pickImageLauncher.launch(intent)
} catch (e: ActivityNotFoundException) {
Timber.w(e, "MultimediaImageFragment:: No app found to select image")
showSnackbar(getString(R.string.no_image_app))
}
}

private fun openDrawingCanvas() {
Expand Down
1 change: 1 addition & 0 deletions AnkiDroid/src/main/res/values/16-multimedia-editor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@
<string name="audio_recording_field_list" comment="Displays a list of the field data in the note editor while audio recording is taking place">Field Contents</string>

<string name="reselect" maxLength="28">Reselect</string>
<string name="no_image_app">No app found to select image</string>

</resources>

0 comments on commit 0549ea1

Please sign in to comment.