void initData() { imageLoader.displayImage( secondGoods.getThumbnail(), second_detail_cover, PricesApplication.options, animateFirstListener); title.setText(secondGoods.getName()); String rmb = res.getString(R.string.rmb); money.setText(rmb + secondGoods.getPrice()); one_prices.setText(rmb + secondGoods.getPrice_cost()); String state = res.getString(R.string.state); String status = res.getString(R.string.status); String reg_time = res.getString(R.string.reg_time); String last_time = res.getString(R.string.last_time); String stateStr = ""; if ("1".equals(secondGoods.getState())) { stateStr = res.getString(R.string.state_one); } else { stateStr = res.getString(R.string.state_two); } cont.setText( state + stateStr + "\n" + status + secondGoods.getStatus() + "\n" + reg_time + secondGoods.getReg_time() + "\n" + last_time + secondGoods.getLast_time()); user_name.setText(secondGoods.getUname()); // user_cont.setText(secondGoods.getMessage().getEmail()); getUser(); }
public void getUser() { String uri = InternetURL.GET_SHANGJIA_URL + "?uid=" + getGson().fromJson(getSp().getString("uid", ""), String.class) + "&access_token=" + getGson().fromJson(getSp().getString("access_token", ""), String.class) + "&id=" + secondGoods.getUid(); StringRequest request = new StringRequest( Request.Method.GET, uri, new Response.Listener<String>() { @Override public void onResponse(String s) { if (StringUtil.isJson(s)) { try { JSONObject jo = new JSONObject(s); String code1 = jo.getString("code"); if (Integer.parseInt(code1) == 200) { GooderData data = getGson().fromJson(s, GooderData.class); gooder = data.getData(); initDataGooder(); } else { Toast.makeText( SecondHandDetailActivity.this, R.string.get_no_data, Toast.LENGTH_SHORT) .show(); } } catch (JSONException e) { e.printStackTrace(); } } else { Toast.makeText( SecondHandDetailActivity.this, R.string.get_no_data, Toast.LENGTH_SHORT) .show(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { Toast.makeText( SecondHandDetailActivity.this, R.string.get_no_data, Toast.LENGTH_SHORT) .show(); } }) { @Override protected Map<String, String> getParams() throws AuthFailureError { Map<String, String> params = new HashMap<String, String>(); return params; } @Override public Map<String, String> getHeaders() throws AuthFailureError { Map<String, String> params = new HashMap<String, String>(); params.put("Content-Type", "application/x-www-form-urlencoded"); return params; } }; getRequestQueue().add(request); }