Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get file from parseObject

It's less android question and more Parse.com question, but I need your help:

I have an image file in a table in my application at Parse.com

The file is ok, I can manually download it and watch it.

But when trying to get it using parseObject that I alreay get from server, I'm getting "null"

code:

  byte[] imageFile = parseObject.getBytes(Statics.COL_IMAGE_FILE);

What am I doing wrong?

p.s. : I can see the image file data/link in the parseObject "estimatedData" field, but can't get him.

like image 808
David Avatar asked Apr 17 '26 06:04

David


1 Answers

If Statics.COL_IMAGE_FILE is a File column, you should do the following to get byte[]:

ParseFile imageFile = (ParseFile)parseObject.get(Statics.COL_IMAGE_FILE);
imageFile.getDataInBackground(new GetDataCallback() {
  public void done(byte[] data, ParseException e) {
    if (e == null) {
      // data has the bytes for the image
    } else {
      // something went wrong
    }
  }
});
like image 166
Héctor Ramos Avatar answered Apr 19 '26 21:04

Héctor Ramos



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!