0

I'm having a trouble saving an ArrayList to Parse.com data browser in android project

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 ??

1 Answers1

0

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.

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

public void put(String key,
                Object value)

Add a key-value pair to this object. It is recommended to name keys in 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. value may not be 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

and if it doesn't accept ArrayLists at all you can put each Bitmap as a String individually

Muhammed Refaat
  • 8,914
  • 14
  • 83
  • 118