Displaying Longitude and Latitude values stored in a SQLite db as a Route on a MapView in Android (Not Real Time)
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-t开发者_StackOverflow社区ime. 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?.
check out this example....
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 ....
精彩评论