简体   繁体   English

将位图列表保存到Parse.com | Android |

[英]Saving list of Bitmaps to Parse.com | Android |

I'm having a trouble saving an ArrayList to Parse.com data browser in android project 我在将ArrayList保存到android项目中的Parse.com数据浏览器时遇到问题

I have the following: 我有以下几点:

ArrayList<Bitmap> images = new ArrayList<Bitmap>();
ParseObject po = new ParseObject("Test");
po.put("images", images);
po.saveInBackground();  

Can anyone help me with that ?? 有人可以帮我吗?

So, regarding to your comment there are two possibilities: 因此,关于您的评论,有两种可能性:

the first one is that you fill that Bitmap ArrayList with Bitmaps which overloads your memory and causes that trouble. 第一个是用位图填充该位图ArrayList,这会使您的内存超载并引起麻烦。

the second one is that may be parse.com doesn't accept ArrayLists at all or doesn't accept ArrayList<Bitmap> as it doesn't include it in the examples of accepted Objects in the documentation, when taking a look at parse.com docs you will find that put method doesn't accept ArrayLists as a value 第二个原因可能是parse.com根本不接受ArrayLists或不接受ArrayList<Bitmap>因为在分析时,它没有将其包含在文档的接受对象示例中。 com docs,您会发现put方法不接受ArrayLists作为value

public void put(String key,
                Object value)

Add a key-value pair to this object. 将键值对添加到该对象。 It is recommended to name keys in partialCamelCaseLikeThis. 建议在partialCamelCaseLikeThis中命名键。

Parameters: 参数:

key - Keys must be alphanumerical plus underscore, and start with a letter. -键必须为字母数字加下划线,并以字母开头。

value - Values may be numerical, String, JSONObject, JSONArray, JSONObject.NULL, or other ParseObjects. -值可以是数字,字符串,的JSONObject,JSONArray,JSONObject.NULL,或其他ParseObjects。 value may not be null. 值不能为null。

UPDATE : 更新

you can add it as an Array<String> that contains a Strings of converted Bitmaps , this link is how to convert a Bitmap to a String and vice-Versa 您可以将其添加为包含转换后的Bitmaps字符串的Array<String>此链接是如何将位图转换为字符串,反之亦然

and if it doesn't accept ArrayLists at all you can put each Bitmap as a String individually 如果它根本不接受ArrayLists ,则可以将每个Bitmap作为String放置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM