基础代码:http://www.jb51.net/article/38479.htm
获取网络资源:http://blog.163.com/023_dns/blog/static/11872736620129290274346/
返回JsonObject:
private JSONObject GetJsonObject() {
try {
StringBuilder builder = new StringBuilder();
HttpResponse response = new DefaultHttpClient().execute(new HttpGet(PublicFunction.UPDATE_URL));
BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
for (String s = reader.readLine(); s != null; s = reader.readLine()) builder.append(s);
return new JSONObject(builder.toString());
} catch (Exception e) {
e.printStackTrace();
return null;
}
}