tags:

views:

42

answers:

1

HI

I write app that hold route information (array of GeoPoint ) for every race.

At the end of each race I want to save information about race. They may have 100-200 GeoPoints (70.22222, -20 33333), each race.

Example for one race:

70.22212, -20 33253 70.25222, -20 33463 70.26232, -20 33573 70.27242, -20 33683 . .

Now I store this information in this array

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

Where to save information for every race in Android (Database, internal XML ....)?

Thanks

+2  A: 

For sharing complex persistent user-defined objects, the following approaches are recommended:

Application Preferences
Files
contentProviders
SQLite DB

If the shared data needs to be retained across points where the application process can be killed, then place that data in persistent storage like Application Preferences, SQLite DB, Files or ContentProviders. Please refer to the Data Storage for further details on how to use these components.

You need to go with SQLite database.

Pentium10
Pentium10 thanks for fast answer. I try with SQLite database but I don't have idea how to put my 'race' array in to database. Can you please help me ? Thanks
Jovan
You will create a table eg: `RacePositions` and you will add as many columns as you need something like `_id`,`raceid`,`lat`,`lon`,`timestamp` The timestamp will give you the order. I highly recommend to post another question specific to your database needs.
Pentium10
Thanks , I post another question for that, you say to create new table for every race?
Jovan
You don't need a new table for every race. You have one table, and you store the data against the raceid field. Good luck.
Pentium10