I am trying to store an image file in Parse.com for use as a profile photo.
I have a function used to capture the image:
private void captureImage() {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
// start the image capture Intent
startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
}
According to Parse documentation, I need to have the data in byte[] form and then create a ParseFile with it. So, I have this:
byte[] data = fileUri.getBytes();
// Save image to Parse
photoFile = new ParseFile("profile_photo.jpg", data);
I am getting an error: cannot resolve method getBytes. Not entirely sure if I am missing an import, or if I am approaching this the entirely wrong way. How can I convert a captured image file to byte form so I can create a ParseFile?