Is there a good way to avoid the \"host is not resolved\" error that crashes an app? Some sort of a way to try connecting to a host ( like a URL ) and see if it\'s even vali
If you are using from kotlin you can create a String.kt and write code bellow:
kotlin
String.kt
fun String.isValidUrl(): Boolean = Patterns.WEB_URL.matcher(this).matches()
Then:
String url = "www.yourUrl.com" if (!url.isValidUrl()) { //some code }else{ //some code }