开发者

Android URL FileNotFoundException Error

开发者 https://www.devze.com 2023-02-26 01:48 出处:网络
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 no

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

精彩评论

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