开发者

Displaying Longitude and Latitude values stored in a SQLite db as a Route on a MapView in Android (Not Real Time)

开发者 https://www.devze.com 2022-12-25 05:06 出处:网络
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开发者_StackOverf

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 ....
0

精彩评论

暂无评论...
验证码 换一张
取 消