Skip to content

Instantly share code, notes, and snippets.

@edwardinubuntu
Created March 28, 2015 03:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edwardinubuntu/959056f324168598a85e to your computer and use it in GitHub Desktop.
Save edwardinubuntu/959056f324168598a85e to your computer and use it in GitHub Desktop.
Create ParseFile
// Create ParseFile
final ParseFile file = new ParseFile(ParseUser.getCurrentUser().getUsername() + "_"+ Calendar.getInstance().getTimeInMillis() + ".jpg", image);
if (progressDialog!=null && !progressDialog.isShowing()) {
progressDialog.show();
}
file.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
final ParseObject imageObject = new ParseObject("GraphicImage");
imageObject.put("imageType", "file");
imageObject.put("imageFile", file);
imageObject.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
if (progressDialog!=null && progressDialog.isShowing()) {
progressDialog.dismiss();
}
// Clear graphic pick
graphicPick = null;
// Setup ImageObject
imageToUploadObject = imageObject;
contentImageView.setImageBitmap(imageBitmapForImageView);
}
});
}
}, new ProgressCallback() {
@Override
public void done(Integer integer) {
Log.d(DailyKind.TAG, "Upload progress: " + integer);
progressDialog.setProgress(integer);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment