当前位置: 代码迷 >> Android >> 为什么错误了
  详细解决方案

为什么错误了

热度:58   发布时间:2016-05-01 13:02:05.0
为什么异常了
使用下面这个获取数据的方法发生异常,怎么回事?请大家帮忙看看,连了网。
Java code
public static InputStream getRequest(String path) throws Exception {            URL url = new URL(path);            HttpURLConnection conn = (HttpURLConnection) url.openConnection();            conn.setRequestMethod("GET");            conn.setConnectTimeout(5000);            if (conn.getResponseCode() == 200){                    return conn.getInputStream();            }            return null;    }


------解决方案--------------------
布局setContentView呢
------解决方案--------------------
你没setContentView。。。
------解决方案--------------------
<uses-permission android:name="android.permission.INTERNET"/>
这个权限加上了吗
  相关解决方案