我已经解析了 JSON 数据并将解析后的 JSON 数据存储到带有键值的 ArrayList HashMap 中,当我想显示解析的数据时,我只得到解析数据的最后一个值,其余所有数据均不显示以供参考
public HashMap<String,String> map = new HashMap<String, String>();
create HASHmap then arraylist
public static ArrayList<HashMap<String, String>> contactList = new ArrayList<HashMap<String, String>>();
void parsing(JSONObject json)
    {
        String id="";
        String countryn="";
        try
        {
            countryobj = json.getJSONArray("country_details");
     for(int i = 0;i<countryobj.length(); i++)
     {
         JSONObject items = countryobj.getJSONObject(i);
         Log.e("i","value==="+i);
         if(items.has("countryid"))
         {
             id = items.getString("countryid");
             map.put("countryid",id);
             Log.e("id","valueID==="+id);
         }
         if(items.has("country"))
         {
             countryn= items.getString("country");
             map.put("country",countryn);
             Log.e("counyrt","valueName==="+countryn);
         }
         contactList.add(i,map);
         Log.e("lisvaluet","val--"+i +contactList.get(i));
     }
    }
    catch (Exception e) {
        // TODO: handle exception
            e.printStackTrace();
    }
在日志中我得到的only 08-20 12:13:45.830: E/--ID---(654): value--{countryid=275, country=Palestinian Territory} with 269 times任何帮助都可以帮助我解决我在存储解析数据时做错的地方,我被困在这里。
