tags:

views:

36

answers:

1

Hello,

I have this array declaration:

List<GeoPoint> race = new ArrayList<GeoPoint>();

I want to store this array in to SQLite database.

Can some one give me code for converting this array in to byte[] or give me code for another solution ?

Thanks

A: 

If your GeoPoint is Serializable you can use a ByteArrayOutputStream plus an ObjectOutputStream.

ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(list);
byte[] result = baos.toByteArray();
oos.close();

Resources :

Colin Hebert