有没有避免的好办法主机没有解决错误崩溃的应用程序?某种形式的方式,试图连接到主机(如URL),看看它甚至是否有效?
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?
使用 URLUtil 以验证URL如下图所示。
Use URLUtil to validate the URL as below.
URLUtil.isValidUrl(url)
这将返回真,如果URL是有效和假的如果URL无效