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 valid?
Use URLUtil to validate the URL as below.
URLUtil.isValidUrl(url)
It will return True if URL is valid and false if URL is invalid.
2.1m questions
2.1m answers
60 comments
57.0k users