// 获取到饲料配方类型成功 public void onSuccess(String result) { // TODO Auto-generated method stub EntityDataPageVo edv = null; try { edv = new Gson().fromJson(result, new TypeToken<EntityDataPageVo>() {}.getType()); if ((edv != null) && (edv.getErrorCode().equals(CommonResultVo.ERROR_CODE_SUCCESS))) { List<NutritionVo> temps1 = new ArrayList<NutritionVo>(); // (ArrayList<NutritionVo>) edv.data; // List<String> temps=new ArrayList<String>(); try { temps1 = JsonUtil.fromJsonArray(JsonUtil.toJson(edv.data), NutritionVo.class); } catch (Exception e) { } if (temps1 != null && temps1.size() > 0) { listNus.addAll(temps1); } else { NutritionVo nv = new NutritionVo(); nv.id = null; nv.name = "无"; nv.systemUnitNum = "无"; nv.systemUnitName = "无"; listNus.add(nv); } nuAdapter = new NutritionListAdapter( listNus, getApplicationContext(), R.layout.fragment_fromula_nutrition_list_item); nuListView.setAdapter(nuAdapter); fixListViewHeight(nuListView); // 数据加载完成改变一下scrollview的显示位置 sv.scrollTo(0, 0); } else { UIHelper.ToastMessage( ActivityFormulaArtificial2.this, "获取配方营养素失败" + edv.getErrorMsg()); } } catch (Exception e) { e.printStackTrace(); UIHelper.ToastMessage( ActivityFormulaArtificial2.this, "获取配方营养素失败,请联系管理员:" + e.getMessage()); } // UIHelper.ToastMessage(_context,"总条数=" + result + ""); }
@Override public void onSuccess(String result) { // TODO Auto-generated method stub EntityDataPageVo edv = null; try { edv = new Gson().fromJson(result, new TypeToken<EntityDataPageVo>() {}.getType()); if ((edv != null) && (edv.getErrorCode().equals(CommonResultVo.ERROR_CODE_SUCCESS))) { // List<FeedVo> temps2 = (ArrayList<FeedVo>) edv.data; List<FeedVo> temps1 = new ArrayList<FeedVo>(); try { temps1 = JsonUtil.fromJsonArray(JsonUtil.toJson(edv.data), FeedVo.class); } catch (Exception e) { } if (temps1 == null || temps1.size() == 0) { // mAdapterMyCreate.notifyDataSetChanged(); Toast.makeText(ActivityFormulaArtificial2.this, "没有更多数据了", Toast.LENGTH_SHORT) .show(); } else { mfs.addAll(temps1); mfsa = new String[mfs.size()]; mfsb = new boolean[mfs.size()]; for (int i = 0; i < mfs.size(); i++) { mfsa[i] = mfs.get(i).name; mfsb[i] = false; } } } else { UIHelper.ToastLongMessage( ActivityFormulaArtificial2.this, "获取饲料失败" + edv.getErrorMsg()); } } catch (Exception e) { e.printStackTrace(); // mStrings.addAll(temps); UIHelper.ToastLongMessage( ActivityFormulaArtificial2.this, "获取饲料失败,请联系管理员:" + e.getMessage()); } }