views:

95

answers:

2

I am currently in the process of creating an application that records current location of a mobile device in intervals, displaying the route as a coloured line on the device in real-time. At the same time the application is storing the longitude and latitude in a SQLite database as I want the user to be able to bring up that specific route again.

The route has a primary key and each waypoint is linked to that route by a foreign key.

What would be the easiest way to display the saved route on the map?.

+1  A: 

check out this example....

Praveen Chandrasekaran
Thanks Praveen :)
LordSnoutimus
A: 

Would I be able to create a cursor with all the waypoint values for a particular track then use a loop and the moveToNext(); method to move through the cursor, adding the overlay for each? for example:

int i = 0;

 do { 
      i++; 

      Cursor cursor = db1.query(TABLE_NAME, FROM, null, null, null, null,
            ORDER_BY);
    Double lat = cursor.getDouble(2);
    Double lon = cursor.getDouble(1);
    cursor.moveToNext();
    overlay.addGeoPoint( new GeoPoint( (int)(lat*1E6),  (int)(lon*1E6)));

 } while ....
LordSnoutimus