@@ -2,6 +2,7 @@ package com.simplemobiletools.notes.pro.activities
2
2
3
3
import android.annotation.SuppressLint
4
4
import android.app.Activity
5
+ import android.content.ActivityNotFoundException
5
6
import android.content.Context
6
7
import android.content.Intent
7
8
import android.content.pm.ShortcutInfo
@@ -41,9 +42,9 @@ import com.simplemobiletools.notes.pro.extensions.*
41
42
import com.simplemobiletools.notes.pro.fragments.TextFragment
42
43
import com.simplemobiletools.notes.pro.helpers.*
43
44
import com.simplemobiletools.notes.pro.models.Note
45
+ import kotlinx.android.synthetic.main.activity_main.*
44
46
import java.io.File
45
47
import java.nio.charset.Charset
46
- import kotlinx.android.synthetic.main.activity_main.*
47
48
import java.util.*
48
49
import kotlin.collections.ArrayList
49
50
@@ -623,7 +624,12 @@ class MainActivity : SimpleActivity() {
623
624
Intent (Intent .ACTION_OPEN_DOCUMENT ).apply {
624
625
addCategory(Intent .CATEGORY_OPENABLE )
625
626
type = " text/*"
626
- startActivityForResult(this , PICK_OPEN_FILE_INTENT )
627
+
628
+ try {
629
+ startActivityForResult(this , PICK_OPEN_FILE_INTENT )
630
+ } catch (e: ActivityNotFoundException ) {
631
+ toast(R .string.no_app_found)
632
+ }
627
633
}
628
634
}
629
635
}
@@ -814,7 +820,11 @@ class MainActivity : SimpleActivity() {
814
820
putExtra(Intent .EXTRA_TITLE , " ${mCurrentNote.title.removeSuffix(" .txt" )} .txt" )
815
821
addCategory(Intent .CATEGORY_OPENABLE )
816
822
817
- startActivityForResult(this , PICK_EXPORT_FILE_INTENT )
823
+ try {
824
+ startActivityForResult(this , PICK_EXPORT_FILE_INTENT )
825
+ } catch (e: ActivityNotFoundException ) {
826
+ toast(R .string.no_app_found)
827
+ }
818
828
}
819
829
}
820
830
}
0 commit comments