存储在单一的parseObject多个ParseFile对象 [英] storing multiple ParseFile objects in single ParseObject

查看:157
本文介绍了存储在单一的parseObject多个ParseFile对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这就是我如何存储ParseFile列表到的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();

在此之后称之为不显示在数据浏览器插入的行,虽然它显示了在表1行计数

after this call it does not show the inserted row in data browser, although it shows rowcount of 1 in table

这是我如何找回它,从列表中得到第一个图片

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);
    }

我能够检索所有字符串列,但对于mediaFiles一栏,而这样做的getData()我得到thisexception。
com.parse.ParseException:目标主机不能为空,或参数设置

我观察到,在ParseFile,数据和URL为空。

有人能请告诉我如何存储和检索多个ParseFile对象为单一的parseObject的code?

Can somebody please show me the code on how to store and retrieve multiple ParseFile objects into single ParseObject?

推荐答案

尝试使用保存方法将它们与解析对象关联之前上传ParseFiles。

Try uploading the ParseFiles using the save method before associating them with the Parse Object.

这篇关于存储在单一的parseObject多个ParseFile对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆