开发者

Android URL FileNotFoundException Error

I am trying to get a file off the internet and im running into some errors. If I have http:// in front of the link it throws a UnkownHostException but if i remove the http:// it gives me a protocal not found error.

my url connection line of code is

String urlS = "http://www.google.com/robots.txt";

URL url = new URL(urlS);

InputStream 开发者_StackOverflow中文版is = url.openStream();

any help thanks


Kind of off topic, but:

You probably want to stay away from url.openStream(); It could just hang since no timeout with it? url openstream might leaving you hanging

You probably want to use the Apache HttpClient.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜