I am using the following code to open default browser if links are external. But so far I can only add two domains (or names). How can I add more ? If the link contains the word "facebook" it will open out side the app. I want to add more names/doamins in there.
if (url.contains("facebook") || url.contains("flipkart")) {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
startActivity(intent)
webView.goBack()
return true
} else {
view?.loadUrl(url)
}
already tried
if (url.contains("facebook,youtube") || url.contains("flipkart")) {
and
if (url.contains("facebook","youtube") || url.contains("flipkart")) {
The only working method I got is following, is there a better option?
if (url.contains("facebook") || url.contains("flipkart") || url.contains("youtube")) {