private void deleteEvent() { new AlertDialog.Builder(this) .setTitle(getString(R.string.delete)) .setMessage(getString(R.string.deleteConfirm)) .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { final ProgressDialog pd = ViewUtils.showProgressDialog(EventDetailActivity.this, getString(R.string.deletingEvent), false); ParseObject eventParseObject = new ParseObject(Event.EVENT); eventParseObject.setObjectId(event.getObjectId()); eventParseObject.deleteInBackground(new DeleteCallback() { @Override public void done(ParseException e) { DatabaseHelper.getHelper(EventDetailActivity.this).getEventIntegerRuntimeExceptionDao().delete(event); ViewUtils.hideProgressDialog(pd); Toast.makeText(EventDetailActivity.this, EventDetailActivity.this.getString(R.string.eventDeletedSuccessfully), Toast.LENGTH_LONG).show(); finish(); } }); } }) .setNegativeButton(android.R.string.no, null) .setIcon(android.R.drawable.ic_dialog_alert) .show(); }
@Kroll.method public void deleteObject(String className, String objectId, final KrollFunction applicationCallback) { DeleteCallback parseCallback = new DeleteCallback() { public void done(ParseException e) { HashMap result = new HashMap(); if (e == null) { result.put("success", true); } else { result.put("error", e.toString()); } applicationCallback.callAsync(getKrollObject(), result); } }; parseSingleton.DeleteDataObject(className, objectId, parseCallback); }
/** * Deletes a snack entry. * * @param position Position of the snack entry to delete * @param failsafe The failsafe's object id must match the snack entry at the specified position. * @param callback The callback to invoke after completion. */ public void deleteSnack(final int position, final SnackEntry failsafe, final DeleteCallback callback){ SnackEntry toDelete = get(position); if(!toDelete.getObjectId().equals(failsafe.getObjectId())){ callback.done(new ParseException(ParseException.OTHER_CAUSE, "Invalid delete")); } else{ get(position).deleteInBackground(new DeleteCallback() { @Override public void done(ParseException e) { if(e == null){ snacks.remove(position); notifyUpdateComplete(e); } callback.done(e); } }); } }
Task<Void> deleteAsync() { final Task<Void>.TaskCompletionSource tcs = Task.create(); deleteInBackground(new DeleteCallback() { @Override public void done(ParseException e) { if (e == null) { logger.log(Level.INFO, "Deleted successfully."); tcs.setResult(null); } else { logger.log(Level.SEVERE, "Unable to delete Surge.", e); tcs.setError(e); } } }); return tcs.getTask(); }
private void deleteWord(Word wordRef) { curWordToDelete = wordRef; reportBack.reportTransient("Delete Button Clicked:" + wordRef.toString()); reportBack.turnOffProgressDialog(); wordRef.getParseObject().deleteInBackground(new DeleteCallback() { @Override public void done(ParseException e) { reportBack.turnOffProgressDialog(); if (e == null) { deleteSuccessful(curWordToDelete); } else { deleteFailed(e,curWordToDelete); } curWordToDelete = null; } }); }
private void deleteItem(ParseObject parseObject) { parseObject.deleteInBackground(new DeleteCallback() { @Override public void done(ParseException e) { if(e==null){ Toast.makeText(ActivityItemDetails.this, "Post Deleted!!", Toast.LENGTH_LONG).show(); deleted = true; onBackPressed(); } } }); }
public ViewHolder(CardView v) { super(v); this.listing_name = (TextView) v.findViewById(R.id.listing_name); this.delete = (ImageView) v.findViewById(R.id.listing_delete); this.createdAt = (TextView) v.findViewById(R.id.listing_created_at); this.listing_image = (ParseCircularImageView) v.findViewById(R.id.listing_image); this.listing_desc = (TextView) v.findViewById(R.id.listing_desc); delete.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ParseObject object = mDataset.get(getPosition()); object.deleteInBackground(new DeleteCallback() { @Override public void done(ParseException e) { if (e == null) { mDataset.remove(getPosition()); notifyItemRemoved(getPosition()); notifyItemRangeChanged(getPosition(), mDataset.size()); fetchMyListings(); } else Toast.makeText(getActivity(), "Please connect to the Internet", Toast.LENGTH_SHORT).show(); } }); } }); }
/** * Once ministers are retrieved this will save them locally under the name of the province they * correspond to, or "Canada" if federal. * @param ministers */ private void saveMinistersLocally(final List<ParseObject> ministers) { ParseObject.unpinAllInBackground(mProvince, ministers, new DeleteCallback() { @Override public void done(ParseException e) { ParseObject.pinAllInBackground(mProvince, ministers); } }); }
private void deleteEntry(){ if(progressOverlay != null) progressOverlay.setVisibility(View.VISIBLE); SnackList.getInstance().deleteSnack(snackPosition, snackEntry, new DeleteCallback() { @Override public void done(ParseException e) { if(e == null){ updateToast("Entry deleted", Toast.LENGTH_SHORT); // Attempt to delete entry's cached image if(snackEntry != null){ ParseFile parseFile = snackEntry.getPhoto(); if(parseFile != null){ String url = parseFile.getUrl(); if(url != null){ if(fileCache.getFile(url).delete()){ Log.d(TAG, "deleteEntry() successfully deleted entry's cached image"); } else{ Log.d(TAG, "deleteEntry() failed to delete entry's cached image"); } } } } finish(); } else{ updateToast("Unable to delete entry", Toast.LENGTH_SHORT); } if(progressOverlay != null) progressOverlay.setVisibility(View.GONE); } }); }
/** */ private void deleteAccountTransactions(List<ParseObject> parseObjects) { if(parseObjects.isEmpty()) { setResult(ACCOUNT_DELETED); finish(); super.showProgress(false); return; } for (ParseObject object : parseObjects) { object.deleteInBackground(new DeleteCallback() { @Override public void done(ParseException e) { mItemsCounter--; if (mItemsCounter <= 0) { setResult(ACCOUNT_DELETED); finish(); showProgress(false); } } }); } }
public void DeleteDataObject(String className, String objectId, DeleteCallback callback) { ParseObject object = ParseObject.createWithoutData(className, objectId); object.deleteInBackground(callback); }