@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; }
@Override protected Void doInBackground(Book... books) { b = books[0]; saveBookLocaly(b); try { ImgurApi imgur = new ImgurApi(context); String res = imgur.uploadImageinForeground(b.isbn, b.img_url); if (!res.equals("error")) { b.img_url = res; ParseObject obj = Book.getParseObjfromBook(b); // Save to parse obj.save(); } else { e = new Exception("Oops! Could not upload image. Please try again."); return null; } } catch (Exception e1) { e = e1; e1.printStackTrace(); } return null; }