无法从JSON URL(android)填充ListView

时间:2017-01-03 20:13:27

标签: android json listview

晚上好,我是Android开发的新手,我在从JSON URL填充ListView时遇到问题

虽然解析很好。这是我到目前为止所尝试的:

try {
        JSONArray array = new JSONArray(result);
        String asef = "";

        for(int i = 0; i < array.length(); i++)
        {

            JSONObject hospital = array.getJSONObject(i);
            JSONObject hospital2 = hospital.getJSONObject("address");
            if (!hospital2.isNull("hospital")) {
                String hospitalName = hospital2.getString("hospital");
                String hospitalLat = hospital.getString("lat");
                String hospitalLon = hospital.getString("lon");
                hospitals.add("hospitalLat");
            }
        }
}

这是我的列表视图

    ListView listView = (ListView) findViewById(R.id.listView);
    ArrayList<String> hospitals = new ArrayList<String>();

0 个答案:

没有答案