Reputation: 303
I have a CITEM class:
public class CITEM {
public Bitmap BMP;
public String DESC;
}
In another class I have an array defined as follows:
ArrayList<CITEM> array;
I need to store the array in a table in a database and had thought of serializing the array. I have two options:
1) A single record with the serialized array.
2) N-Records serializing CITEM objects.
Serializing a Bitmap not a problem but not how to serialize the array. What is the best option? And how I can do?
Thank you in advance.
Upvotes: 0
Views: 180
Reputation: 157467
you can not serialize your CITEM
object since Bitmap
does not implements Serializable
. You can encode your bitmap Base64
and serialize the Base64 strings
Upvotes: 1
Reputation: 781
I use to Serialize the ArrayList Directly. The ArrayList is a Serializable object btw. All the data kept after you Serialize it or user ObjectOutputStream to save it in file system. etc, If Bitmap is not a problem.
You can check more information here ArrayList
hope that I can help you.
Upvotes: 0