Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.cyclestreets

import android.annotation.SuppressLint
import android.content.ActivityNotFoundException
import android.content.Context
import android.content.Intent
import android.net.Uri
Expand All @@ -12,6 +13,7 @@ import android.view.ViewGroup
import android.webkit.WebResourceRequest
import android.webkit.WebView
import android.webkit.WebViewClient
import android.widget.Toast

import net.cyclestreets.fragments.R

Expand Down Expand Up @@ -57,7 +59,11 @@ open class WebPageFragment : Fragment {

// Otherwise, give the default behavior (open in browser)
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
context.startActivity(intent)
try {
context.startActivity(intent)
} catch (e: ActivityNotFoundException) {
Toast.makeText(context, R.string.no_app_to_open_link, Toast.LENGTH_SHORT).show()
}
return true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,6 @@
<string name="storedroutes_detail_default">Details</string>
<string name="storedroutes_detail_format">%1$s route, %2$s</string>

<string name="no_app_to_open_link">No app found to open this link</string>

</resources>