diff --git a/app/src/main/java/com/etesync/syncadapter/ui/WebViewActivity.kt b/app/src/main/java/com/etesync/syncadapter/ui/WebViewActivity.kt index fe3c90e8..67ef44e5 100644 --- a/app/src/main/java/com/etesync/syncadapter/ui/WebViewActivity.kt +++ b/app/src/main/java/com/etesync/syncadapter/ui/WebViewActivity.kt @@ -2,6 +2,7 @@ package com.etesync.syncadapter.ui import android.annotation.SuppressLint import android.annotation.TargetApi +import android.content.ActivityNotFoundException import android.content.Context import android.content.Intent import android.net.Uri @@ -11,6 +12,7 @@ import android.view.KeyEvent import android.view.View import android.webkit.* import android.widget.ProgressBar +import android.widget.Toast import androidx.appcompat.app.ActionBar import com.etesync.syncadapter.Constants import com.etesync.syncadapter.R @@ -127,7 +129,11 @@ class WebViewActivity : BaseActivity() { return true } } else { - startActivity(Intent(Intent.ACTION_VIEW, uri)) + try { + startActivity(Intent(Intent.ACTION_VIEW, uri)) + } catch (e: ActivityNotFoundException) { + Toast.makeText(this, getString(R.string.open_url_no_activity), Toast.LENGTH_LONG).show() + } return true } } @@ -163,7 +169,11 @@ class WebViewActivity : BaseActivity() { intent.putExtra(WebViewActivity.KEY_URL, uri) context.startActivity(intent) } else { - context.startActivity(Intent(Intent.ACTION_VIEW, uri)) + try { + context.startActivity(Intent(Intent.ACTION_VIEW, uri)) + } catch (e: ActivityNotFoundException) { + Toast.makeText(context, context.getString(R.string.open_url_no_activity), Toast.LENGTH_LONG).show() + } } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9979018e..3571bd01 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -374,6 +374,7 @@ Loading... Loading Error Refresh + Failed opening link: link is not supported! From File