@Override public void mGetInfo(String content) { super.mGetInfo(content); List<ShopBean> list = new ArrayList<ShopBean>(); ShopBean sBean = null; JSONObject json; try { json = new JSONObject(content); JSONObject zjson = null; for (int i = 0; i < json.length(); i++) { zjson = json.getJSONObject("shop" + (i + 1)); sBean = new ShopBean(); sBean.shopId = zjson.getInt("shopId"); sBean.bAccount = zjson.getString("account"); sBean.shopImg = zjson.getString("shopImg"); sBean.shopName = zjson.getString("shopName"); sBean.shopTime = zjson.getString("shopTime"); sBean.shopAddress = zjson.getString("shopAddr"); sBean.by = zjson.getInt("by"); this.maxPage = zjson.getInt("sumPage"); JSONObject sjson = new JSONObject(zjson.getString("sunday")); JSONObject ojson = null; List<SundayShopBean> slist = new ArrayList<SundayShopBean>(); SundayShopBean ssbean = null; for (int j = 0; j < sjson.length(); j++) { ojson = sjson.getJSONObject("sun" + (j + 1)); ssbean = new SundayShopBean(); ssbean.tcType = ojson.getInt("tcType"); ssbean.discount = ojson.getDouble("discount"); ssbean.color = ojson.getString("color"); ssbean.payNum = ojson.getInt("payNum"); ssbean.lastNum = ojson.getInt("lastNum"); ssbean.sundayId = ojson.getInt("sundayId"); slist.add(ssbean); } sBean.dayType = slist; list.add(sBean); } } catch (JSONException e) { e.printStackTrace(); } Collections.sort( list, new Comparator<Object>() { public int compare(Object a, Object b) { int one = ((ShopBean) a).by; int two = ((ShopBean) b).by; return one - two; } }); Sources.SUNDAYINFO.addAll(list); mod.mSuccess(); }
@Override public void mGetInfo(String content) { super.mGetInfo(content); if (content != null && !content.equals("null")) { try { JSONObject json = new JSONObject(content); Sources.JIANSHAO = json.getString("jianjie"); Sources.XIUZHI = json.getString("xuzhi"); Sources.TICHENG = json.getDouble("bili"); } catch (JSONException e) { e.printStackTrace(); } mod.mSuccess(); } }