public static final String readURL(String url)throws Throwable
{
try {
InputStream in = (InputStream) fetch(url);
byte[] bArr = readBytes(in);
return new String(bArr);
} catch (Throwable e) {
throw e;
}
}
public static final Object fetch(String address) throws MalformedURLException,IOException {
URL url = new URL(address);
Object content = url.getContent();
return content;
}
我背后的代理,当我尝试如何解决这个UnknownHostException?
readURL( “http://abc.com”)
访问URL http://abc.com它抛出的java.net.UnknownHostException: 我:
<uses-permission android:name="android.permission.INTERNET" />
清单文件中的
。
任何快速解决方案?
复制代码:http://stackoverflow.com/questions/1432961/how-do-i-make-httpurlconnection-use-a-proxy –