예제 #1
0
    @Override
    protected Void doInBackground(Clicker... clickers) {
      b = clickers[0];
      try {
        ImgurApi imgur = new ImgurApi(context);
        String s = Long.toString(System.currentTimeMillis());
        b.objectId = s;
        String res = imgur.uploadImageinForeground(b.objectId, b.img_url);

        if (!res.equals("error")) {
          b.img_url = res;
          ParseObject obj = Clicker.getParseObjfromClicker(b);
          // Save to parse
          obj.save();
        } else e = new Exception("Oops! Could not upload image. Please try again.");
      } catch (Exception e1) {
        e1.printStackTrace();
        e = e1;
      }
      return null;
    }