This is how I store ParseFile List into ParseObject
ParseObject pObject = new ParseObject();
ArrayList<ParseFile> pFileList = new ArrayList<ParseFile>();
for (String thumbPath : thumbList) {
byte[] imgData = convertFileToByteArray(thumbPath);
ParseFile pFile = new ParseFile("mediaFiles",imgData);
pFileList.add(pFile);
}
pObject.addAll("mediaFiles", pFileList);
pObject.saveEventually();
after this call it does not show the inserted row in data browser, although it shows rowcount of 1 in table
This is how i retrieve it and get the first image from the list
List<ParseFile> pFileList = (ArrayList<ParseFile>) pObject.get("mediaFiles");
if (!pFileList.isEmpty()) {
ParseFile pFile = pFileList.get(0);
byte[] bitmapdata = pFile.getData(); // here it throws error
bitmap = BitmapFactory.decodeByteArray(bitmapdata, 0, bitmapdata.length);
}
I am able to retrieve all String columns , but for "mediaFiles" column while doing getData() I get thisexception. com.parse.ParseException: Target host must not be null, or set in parameters.
I observed that in ParseFile, data and url is null.
Can somebody please show me the code on how to store and retrieve multiple ParseFile objects into single ParseObject?
Try uploading the ParseFiles using the save method before associating them with the Parse Object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With