第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

我為什么找不到j(luò)son啊

小白一只,我的project中為什么找不到j(luò)son啊

正在回答

1 回答

自己寫一個(gè)工具類

public?class?Data?{
????private?static?JSONArray?pieData;

????public?static?String?getPieData()?throws?JSONException?{
????????if?(pieData?==?null)?{
????????????synchronized?(Data.class)?{
????????????????if?(pieData?==?null)?{
????????????????????pieData?=?new?JSONArray();
????????????????????HashMap<String,?Integer>?map1?=?new?HashMap<>();
????????????????????map1.put("外賣",?34);
????????????????????map1.put("娛樂",?21);
????????????????????map1.put("其他",?45);
????????????????????pieData.put(getItem("2018年1月",?map1));

????????????????????HashMap<String,?Integer>?map2?=?new?HashMap<>();
????????????????????map2.put("外賣",?42);
????????????????????map2.put("娛樂",?65);
????????????????????map2.put("其他",?12);
????????????????????pieData.put(getItem("2018年2月",?map2));

????????????????????HashMap<String,?Integer>?map3?=?new?HashMap<>();
????????????????????map3.put("外賣",?34);
????????????????????map3.put("娛樂",?123);
????????????????????map3.put("其他",?24);
????????????????????pieData.put(getItem("2018年3月",?map3));

????????????????????HashMap<String,?Integer>?map4?=?new?HashMap<>();
????????????????????map4.put("外賣",?56);
????????????????????map4.put("娛樂",?45);
????????????????????map4.put("其他",?90);
????????????????????pieData.put(getItem("2018年4月",?map4));
????????????????}
????????????}
????????}

????????return?pieData.toString();
????}


????@SuppressLint("NewApi")
????private?static?JSONObject?getItem(String?date,?HashMap<String,?Integer>?map)?throws?JSONException?{
????????JSONObject?obj?=?new?JSONObject();
????????JSONArray?arr?=?new?JSONArray();

????????Set<String>?set?=?map.keySet();
????????String[]?keys?=?new?String[set.size()];
????????set.toArray(keys);
????????for?(int?i?=?0;?i?<?keys.length;?i++)?{
????????????JSONObject?object?=?new?JSONObject();
????????????object.put("title",?keys[i]);
????????????object.put("value",?map.get(keys[i]));
????????????arr.put(object);
????????}
????????obj.put("date",?date);
????????obj.put("obj",?arr);
????????return?obj;
????}


}


0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

我為什么找不到j(luò)son啊

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)