@@ -25,6 +25,7 @@ import android.webkit.WebView
2525import android.webkit.WebViewClient
2626import android.widget.ImageView
2727import android.widget.TextView
28+ import android.widget.Toast
2829import com.simplemobiletools.commons.dialogs.*
2930import com.simplemobiletools.commons.extensions.*
3031import com.simplemobiletools.commons.helpers.*
@@ -649,7 +650,9 @@ class MainActivity : SimpleActivity() {
649650 try {
650651 startActivityForResult(this , PICK_OPEN_FILE_INTENT )
651652 } catch (e: ActivityNotFoundException ) {
652- toast(R .string.no_app_found)
653+ toast(R .string.system_service_disabled, Toast .LENGTH_LONG )
654+ } catch (e: Exception ) {
655+ showErrorToast(e)
653656 }
654657 }
655658 }
@@ -852,7 +855,9 @@ class MainActivity : SimpleActivity() {
852855 try {
853856 startActivityForResult(this , PICK_EXPORT_FILE_INTENT )
854857 } catch (e: ActivityNotFoundException ) {
855- toast(R .string.no_app_found)
858+ toast(R .string.system_service_disabled, Toast .LENGTH_LONG )
859+ } catch (e: Exception ) {
860+ showErrorToast(e)
856861 }
857862 }
858863 }
@@ -877,7 +882,14 @@ class MainActivity : SimpleActivity() {
877882 type = EXPORT_MIME_TYPE
878883 putExtra(Intent .EXTRA_TITLE , fileName)
879884 addCategory(Intent .CATEGORY_OPENABLE )
880- startActivityForResult(this , PICK_EXPORT_NOTES_INTENT )
885+
886+ try {
887+ startActivityForResult(this , PICK_EXPORT_NOTES_INTENT )
888+ } catch (e: ActivityNotFoundException ) {
889+ toast(R .string.system_service_disabled, Toast .LENGTH_LONG )
890+ } catch (e: Exception ) {
891+ showErrorToast(e)
892+ }
881893 }
882894 }
883895
@@ -900,7 +912,14 @@ class MainActivity : SimpleActivity() {
900912 Intent (Intent .ACTION_GET_CONTENT ).apply {
901913 addCategory(Intent .CATEGORY_OPENABLE )
902914 type = EXPORT_MIME_TYPE
903- startActivityForResult(this , PICK_IMPORT_NOTES_INTENT )
915+
916+ try {
917+ startActivityForResult(this , PICK_IMPORT_NOTES_INTENT )
918+ } catch (e: ActivityNotFoundException ) {
919+ toast(R .string.system_service_disabled, Toast .LENGTH_LONG )
920+ } catch (e: Exception ) {
921+ showErrorToast(e)
922+ }
904923 }
905924 }
906925
0 commit comments