没有key的Json,例如:["http://www.cnblogs.com/Cherry-B/p/4625133.html","http://www.cnblogs.com/Cherry-B/p/4619689.html","http://www.cnblogs.com/Cherry-B/p/4613701.html"]
public void alyJson(String urls) { ArrayList<String> urlList = null; if (urls != null) { try { JSONArray array = new JSONArray(urls); urlList = new ArrayList<String>(); for (int i = 0; i < array.length(); i++) { String s = array.getString(i); urlList.add(s); } } catch (JSONException e) { e.printStackTrace(); } } if (urlList != null) { for (String url : urlList) { webView.loadUrl(url); } } }
时间: 2024-10-25 21:36:08