Skip to content

Instantly share code, notes, and snippets.

@akuafif
Created December 10, 2015 21:59
Show Gist options
  • Save akuafif/63ed02370e5f44430896 to your computer and use it in GitHub Desktop.
Save akuafif/63ed02370e5f44430896 to your computer and use it in GitHub Desktop.
[Java/Android] BaasBox - Delete a File
BaasFile oldFile = new BaasFile();
// Fetch the file from server
oldFile.fetch(oldFileID, new BaasHandler<BaasFile>() {
@Override
public void handle(BaasResult<BaasFile> baasResult) { // Successfully fetch file
if (baasResult.isSuccess()) {
Log.d(TAG, "Received old file");
// Delete the file from server
baasResult.value().delete(new BaasHandler<Void>() {
@Override
public void handle(BaasResult<Void> baasResult) {
if (baasResult.isSuccess())
Log.d(TAG, "Old File Deleted");
else if (baasResult.isFailed())
Log.d(TAG, "Error");
}
});
} else if (baasResult.isFailed()) {
Log.e(TAG, "Error");
} else
Log.d(TAG, "Error");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment