Skip to content

Instantly share code, notes, and snippets.

@veiz
Created November 7, 2016 11:42
Show Gist options
  • Select an option

  • Save veiz/92083e7714f6a7bbaf9c3cdb821552b7 to your computer and use it in GitHub Desktop.

Select an option

Save veiz/92083e7714f6a7bbaf9c3cdb821552b7 to your computer and use it in GitHub Desktop.
public void updateAvatar(File avatarFile) {
QBEntityCallback callback = new QBEntityCallback<QBAttachment>() {
@Override
public void onSuccess(QBAttachment attachment, Bundle params) {
Timber.v("ok");
}
@Override
public void onError(QBResponseException e) {
Timber.e(e.getMessage());
}
};
QBContent.uploadFileTask(avatarFile, true, null, null).performAsync(
new QbEntityCallbackTwoTypeWrapper<QBFile, QBAttachment>(callback) {
@Override
public void onSuccess(QBFile qbFile, Bundle bundle) {
QBUser user = new QBUser();
user.setId(300);
user.setFileId(qbFile.getId());
QBUsers.updateUser(user);
}
@Override
public void onError(QBResponseException error) {
super.onError(error);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment