在浏览器中输入http://localhost:8080/index.jsp没有问题,但是使用android模拟器,将报W/System.err(1042): Caused by: java.net.ConnectException:localhost/127.0.0.1:8080Connection refused
这说明连接本地的服务器被拒绝了。
使用http://www.baidu.com/img/baidu_jgylogo1.gif没有问题,在cmd中,使用ipconfig命令查看本地的ip,将locathost修改成192.168.1.101文件搞定。
代码如下:
PageTask task = new PageTask();
//task.execute("http://www.baidu.com/img/baidu_jgylogo1.gif");
task.execute("http://192.168.1.101:8080/index.jsp");