心衰管理

心衰管理 map类型的数据转化成对象存储

Object data
        Map resultMap = (Map) data;//从这里看数据不是json,而是键值对的集合
        if (resultMap == null) {
            //网络访问获取数据失败
            //ShowUtil.showToast(context, R.string.check_network_timeout);
        } else {
            //intValue() 将数据转化成数字
            //intValue()     以 int 形式返回此 Double 的值(通过强制转换为 int 类型)。
            page=Double.valueOf(resultMap.get("pageNo").toString()).intValue();
            //从返回的数据中接受总页数的信息 等加载下一页的时候用到
            totalPage=Double.valueOf(resultMap.get("totalPage").toString()).intValue();
            //list中封装的数据每一个条目都是键值对的集合
            List list = (List) resultMap.get("resultSet");

            sportList.clear();
            for (int i = 0; i < list.size(); i++) {            
                //每次都重新定义一个对象
                ZiXun zixunInfo =new ZiXun();
                Map temp = new HashMap();
                temp = (Map)list.get(i);

                zixunInfo.newId = (String) temp.get("UUID");
                zixunInfo.title = (String) temp.get("TITLE");
                zixunInfo.contentRead = (String) temp.get("CONTENT_TEMP");
                zixunInfo.image = (String) temp.get("ICON_URL");
                zixunInfo.time = (String) temp.get("CREATE_TIME");
                zixunInfo.content = (String) temp.get("CONTENT");
                zixunInfo.good = String.valueOf(Double.valueOf(
                        temp.get("PRAISE_COUNT").toString()).intValue());
                zixunInfo.house = String.valueOf(Double.valueOf(
                        temp.get("COLLECT_FLAG").toString()).intValue());
                zixunInfo.type = ZiXun.TYPE_ZIXUN;
                //Log.d("tanyinqing",zixunInfo.toString());
                sportList.add(zixunInfo);
            }

results matching ""

    No results matching ""