抱歉,现在才看到您的答案,我一直在做一些代码:这是我的代码:
ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
JSONObject mainJson = new JSONObject(reply);
JSONArray jsonArray = mainJson.getJSONArray("Companies");
for (int i = 0; i < jsonArray.length(); i++) {
HashMap<String, String> map = new HashMap<String, String>();
JSONObject objJson = jsonArray.getJSONObject(i);
map.put("ID", objJson.getString("CompanyID"));
map.put("name", objJson.getString("CompanyName"));
mylist.add(map);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
但日志显示错误解析数据或.json.exception!!