3

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);

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks , can you please give me simple code for converting in to JSON ?
1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.