// 获取到饲料配方类型成功
        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 + "");
        }
Esempio n. 2
0
  private boolean checkValue() {
    String msg = "";

    if (StringUtils.isEmpty(mUserName)) {
      msg = getString(R.string.login_check_account);
      // metAccount.setError("");
      metAccount.requestFocus();
      UIHelper.ToastMessage(getApplicationContext(), msg);
      return false;
    }

    if (StringUtils.isEmpty(mPassword)) {
      msg = getString(R.string.login_check_password);

      // metPassword.setError("");
      metPassword.requestFocus();
      UIHelper.ToastMessage(getApplicationContext(), msg);
      return false;
    }

    return true;
  }
 @Override
 public void onFailure(int error, String msg) {
   UIHelper.ToastMessage(ActivityFormulaArtificial2.this, "获取配方营养素失败" + msg);
 }
 @Override
 public void onCancel() {
   // TODO Auto-generated method stub
   UIHelper.ToastMessage(ActivityFormulaArtificial2.this, "获取配方营养素退出");
 }
 @Override
 public void onFailure(int error, String msg) {
   // TODO Auto-generated method stub
   UIHelper.ToastMessage(ActivityFormulaArtificial2.this, "获取饲料失败" + msg);
 }