Exemplo n.º 1
0
        @Override
        public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
          super.onSuccess(statusCode, headers, response);

          int result = 0;

          try {
            result = Integer.valueOf(response.getString("result"));
          } catch (NumberFormatException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
          if (result == 1 && statusCode == 200) {

            AlertDialog.Builder builder = new Builder(E8_ResetPwdActivity.this);
            builder.setTitle("修改成功");

            builder.setNegativeButton(
                "确认",
                new DialogInterface.OnClickListener() {

                  public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    finish();
                    overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
                  }
                });
            builder.create().show();

          } else {
            Log.i("reset_pwd", response.toString());
            try {
              String message = response.getString("message");
              AlertDialog.Builder builder = new Builder(E8_ResetPwdActivity.this);
              builder.setTitle(message);

              builder.setNegativeButton(
                  "确认",
                  new DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface dialog, int which) {
                      dialog.dismiss();
                      finish();
                      overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
                    }
                  });
              builder.create().show();
            } catch (JSONException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
          }
        }
Exemplo n.º 2
0
        @Override
        public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
          super.onSuccess(statusCode, headers, response);

          int result = 0;

          try {
            result = Integer.valueOf(response.getString("result"));
          } catch (NumberFormatException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
          if (result == 1 && statusCode == 200) {
            try {
              data.clear();
              JSONObject sData = response.getJSONObject("data");
              String img_url = LandousAppConst.special_img_head + sData.get("special_image");
              ImageLoader.getInstance()
                  .displayImage(img_url, banner, BeeFrameworkApp.options_no_default);

              android.view.ViewGroup.LayoutParams params = banner.getLayoutParams();
              params.height = banner.getWidth() / 5 * 2;
              params.width = banner.getWidth();
              banner.setLayoutParams(params);
              title.setText(sData.getString("special_title"));
              JSONArray array = sData.getJSONArray("special_product_list");
              for (int i = 0; i < array.length(); i++) {
                JSONObject jsonItem = array.getJSONObject(i);
                Map<String, String> map = new HashMap();
                String store_id = jsonItem.getString("store_id") + "/";
                map.put("goods_name", jsonItem.getString("goods_name"));
                map.put("store_name", jsonItem.getString("store_name"));
                map.put("goods_marketprice", jsonItem.getString("goods_marketprice"));
                map.put("goods_price", jsonItem.getString("goods_price"));
                map.put("goods_id", jsonItem.getString("goods_id"));
                map.put(
                    "goods_image",
                    LandousAppConst.HOME_IMG_URL + store_id + jsonItem.getString("goods_image"));
                data.add(map);
              }

            } catch (JSONException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
            goodsAdapter.notifyDataSetChanged();
            loadingPDialog.dismiss();
          }
        }