我在解析XML文件时遇到了问题,我使用newsRSS解析器作为参考。但是我在实际的device.how中收到此错误显示一条错误消息,如警告用户,让他留在应用程序没有崩溃?java.lang.RuntimeException:java.net.UnknownHostException:主机未解决:
这是做连接和解析代码的和平:
protected Config_Parser(String feedUrlString,Context context){
this.context = context;
try {
this.feedUrl = new URL(feedUrlString);
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
protected InputStream getInputStream() {
try {
return feedUrl.openConnection().getInputStream();
} catch (IOException e) {
Log.e("Error", "error happned");
return null;
//throw new RuntimeException(e);
}
}
我怎么可以处理这个错误与发送警报给用户没有崩溃或退出应用程序?
感谢您的帮助:)
您的日志消息不是很有帮助。它没有给出任何错误实际上的迹象。 – unholysampler