I am attempting to use this reference:
https://www.parse.com/docs/android/guide#files
To understand how to get a file taken by the camera and save it to Parse. I have this code:
private File getOutputMediaFile(int type) {
// External sdcard location
String appName = CameraActivity.this.getString(R.string.app_name);
File mediaStorageDir = new File(
Environment
.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),
appName);
// Create the storage directory if it does not exist
if (!mediaStorageDir.exists()) {
if (!mediaStorageDir.mkdirs()) {
Log.d(appName, "Oops! Failed create "
+ appName + " directory");
return null;
}
}
// Create a media file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss",
Locale.getDefault()).format(new Date());
final File mediaFile;
if (type == MEDIA_TYPE_IMAGE) {
mediaFile = new File(mediaStorageDir.getPath() + File.separator
+ "IMG_" + timeStamp + ".jpg");
} else {
return null;
}
final ParseFile photoFile;
byte[] data = mediaFile.getBytes();
// Save the scaled image to Parse
photoFile = new ParseFile("profile_photo.jpg", data);
But I get the error: cannot resolve getBytes.
Do I need to convert this file to something else before using getBytes? Is it in the wrong format?