如何保存每给定一小时在数据库sqlite中更改的位置的坐标gps纬度和经度。
这是我的代码,
public void onLocationChanged( final Location location) {
Log.e("GPS", "Latitude " + location.getLatitude() + " et longitude " + location.getLongitude());
BDHandler = new DatabaseHandler(null);
db = BDHandler.getWritableDatabase();
Thread th= new Thread() {
public void run()
{
ContentValues value = new ContentValues();
value.put("LONGITUDE", Double.toString(location.getLatitude()));
value.put("LATITUDE", Double.toString( location.getLongitude()));
{ try
{
while(true)
{
Thread.sleep(360000);
{
db.insert("Table_name", null, value);
}
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
};
th.start();
}