@Override protected void onResume() { super.onResume(); MobclickAgent.onResume(this); if (loginStatus()) { try { final LoginUser user = getHelper().getUser(); if (user == null) { return; } if (Util.fmtDate .parse(ac.cs.getLoginTime(user.getId())) .before(Util.fmtDate.parse(Util.fmtDate.format(new Date())))) { ac.finalHttp.post( URL.EVERYDAY_LOGIN, getAjaxParams(), new MyJsonHttpResponseHandler(this) { @Override public void onSuccessRetCode(JSONObject jo) throws Throwable { jo = new JSONObject(jo.getString(URL.RESPONSE)); ac.cs.setLoginTime(user.getId(), Util.fmtDate.format(new Date())); Intent intent = new Intent(DogCoinActivity.TAG); intent.putExtra("coin", jo.getString("coin")); sendBroadcast(intent); if ("1".equals(jo.getString("result"))) { new Handler() .postDelayed( new Runnable() { @Override public void run() { LayoutInflater inflater = LayoutInflater.from(BaseActivity.this); View view = inflater.inflate(R.layout.login_remind, null); Toast toast = new Toast(BaseActivity.this); toast.setGravity(Gravity.FILL, 0, 0); toast.setDuration(Toast.LENGTH_SHORT); toast.setView(view); toast.show(); } }, 1000); } } @Override public void onFailure() {} }); } } catch (ParseException e) { e.printStackTrace(); } } }
public void uploadImg(int i) { LogUtil.d("================图片上传次数", i + ""); if (i == fragment.getCount()) { return; } LoginUser user = getHelper().getUser(); try { RequestParams ap = getAjaxParams(); ap.put("file", new File(fragment.getItem(i))); ap.put("userid", user.getId()); ap.put("dyid", dyid); ap.put("position", i + ""); ac.finalHttp.post(URL.PUBLISH_IMG, ap, new callBack(i)); } catch (FileNotFoundException e) { e.printStackTrace(); } }