Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
aakarshrestha
6,509 PointsImage file is not saved in parse. - Ribbit App
In the RecipientsActivity class, we have the method
protected ParseObject createMessage() { ParseObject message = new ParseObject(ParseConstants.CLASS_MESSAGES); message.put(ParseConstants.KEY_SENDER_ID, ParseUser.getCurrentUser().getObjectId()); message.put(ParseConstants.KEY_SENDER_NAME, ParseUser.getCurrentUser().getUsername()); message.put(ParseConstants.KEY_RECIPIENT_IDS, getRecipientIds()); message.put(ParseConstants.KEY_FILE_TYPE, mFileType);
byte[] fileBytes = FileHelper.getByteArrayFromFile(this, mMediaUri);
if (fileBytes == null) {
return null;
} else {
if (mFileType.equals(ParseConstants.TYPE_IMAGE)) {
fileBytes = FileHelper.reduceImageForUpload(fileBytes);
}
String fileName = FileHelper.getFileName(this, mMediaUri, mFileType);
ParseFile file = new ParseFile(fileName, fileBytes);
message.put(ParseConstants.KEY_FILE, file);
return message;
}
}
I can only send the video file, which take a while though. But when I try to send the image file, it does not work at all. I do not see any error message in the logcat either.
Can anyone help, please?