Example #1
0
    @Override
    protected BaseWsResponse doInBackground(String... arg0) {
      BaseWsResponse response = new BaseWsResponse();

      int responseCode;
      try {
        //            responseCode = new HttpCaller(uploadAddr).upload(params, filePath, null);
        responseCode = new HttpCaller(null).uploadSingleFile(file, params, uploadAddr);
        if (responseCode == 200) response.getHashMap().put("result", "ok");
      } catch (Exception e) {
        e.printStackTrace();
      }

      return response;
    }
Example #2
0
    @Override
    protected void onPostExecute(BaseWsResponse result) {
      super.onPostExecute(result);
      proDialog.cancel();
      String resultCode = (String) result.getHashMap().get("result");

      if (null != resultCode && resultCode.equalsIgnoreCase("ok")) {
        DialogUtil.displayWarning(
            activity,
            getString(R.string.sys_msg),
            getString(R.string.photo_upload_successful),
            false,
            null);
        previewImage.setImageBitmap(null);
        deleteOldPhotos(photoRealPath);
        saveSinglePoint("", "");
        savePhoto(photoName, "");
      } else {
        DialogUtil.displayWarning(
            activity,
            getString(R.string.sys_msg),
            getString(R.string.photo_upload_fail),
            false,
            new OnClickListener() {
              @Override
              public void onClick(View v) {}
            });
      }
    }