parse.com save images

1.2k views Asked by At

I'm trying to make a tablet app for Android using parse.com. I'm not good at Android yet but i'm trying to get and object using this:

ParseFile applicantResume = (ParseFile)anotherApplication.get("applicantResumeFile");
applicantResume.getDataInBackground(new GetDataCallback() {
  public void done(byte[] data, ParseException e) {
    if (e == null) {
       // data has the bytes for the resume
    } else {
       // something went wrong
    }
  }
});

It seems like i need to save the new object i just got but i have problems saving it this way:

FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
fos.write(data.getBytes());
fos.close();

Any idea how to save data? The parse API says it's byte[], can't make it work :(

1

There are 1 answers

0
Chad Bingham On

You need to convert your image to a byte[]. This is how I was able to do it; My Code. Just be sure you understand where your pictures really are. Using the correct filepath was my trouble.

After many emails and questions on Parse.com, I realized that they are not android friendly. As soon as I have a better understanding of it all, I plan to post some tutorials on YouTube.

Good luck!