Tim*_*ons 6 android parse-platform
这就是我将ParseFile List存储到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();
Run Code Online (Sandbox Code Playgroud)
在此调用之后,它不会在数据浏览器中显示插入的行,尽管它在表中显示了rowcount为1
这是我如何检索它并从列表中获取第一个图像
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);
}
Run Code Online (Sandbox Code Playgroud)
我能够检索所有String列,但是对于"mediaFiles"列,在执行getData()时,我得到了这个例外. com.parse.ParseException:目标主机不能为null,或者在参数中设置.
我观察到在ParseFile中,data和url为null.
有人可以告诉我如何将多个ParseFile对象存储和检索到单个ParseObject中的代码吗?
| 归档时间: |
|
| 查看次数: |
3324 次 |
| 最近记录: |