老师为什么只能显示第30行的数据?
private List<NewsBean> getJsonData(String url){
List<NewsBean> newsBeanlist = new ArrayList<>();
try {
String jsonString = readStream(new URL(url).openStream());
Log.d("haha", jsonString);
JSONObject jsonobject;
NewsBean newsbean;
try {
//通过jsonobject取出json
jsonobject = new JSONObject(jsonString);
JSONArray jsonarray = jsonobject.getJSONArray("data");
//遍历json
for (int i = 0; i < jsonarray.length(); i++) {
jsonobject = jsonarray.getJSONObject(i);
newsbean = new NewsBean();
newsbean.newsIconUrl =jsonobject.getString("picSmall");
newsbean.newsTitle =jsonobject.getString("name");
newsbean.newContent =jsonobject.getString("");
newsBeanlist.add(newsbean);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return newsBeanlist;
}