tags:

views:

58

answers:

2

HI,

I have array list of geopoints

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

I want to put geoPointsArray array in to SQLite database and then fetch the data back as an array.

If anyone has a solution I would be greatly appreciated.

P.S.

Now I use ContentValues for insert into array as:

        ContentValues initialValues = new ContentValues();
        initialValues.put(KEY_TIME, time);
        db.insert(tableName, null, initialValues);
A: 

I want to put geoPointsArray array in to SQLite database and then fetch the data back as an array.

Serialize the GeoPoint array to JSON and store it in a TEXT column.

CommonsWare
Thanks , can you please give me simple code for converting in to JSON ?
Jovan
+1  A: 

Or different: Because a GeoPoint is build out of 2 integers, just store these integers in 2 columns called 'latitudeE6' and 'longitudeE6', which eliminates any overhead like JSON.

mreichelt