简体   繁体   English

如何计算 android 上 SQLite DB 中每条记录的值并更新该值?

[英]How to calculate the value and update that for each record in SQLite DB on android?

My database has several records and each record has object's location (2 fields: latitude and longitude).我的数据库有几条记录,每条记录都有对象的位置(2 个字段:纬度和经度)。 I need to calculate the distance from the current user's location to each object (with distanceBetween method).我需要计算当前用户位置到每个 object 的距离(使用distanceBetween方法)。 Then this value should be written into another database field (distance).然后这个值应该被写入另一个数据库字段(距离)。

How should I do that?我该怎么做?

You shouldn't... calculated fields should not be stored.你不应该......计算字段不应该被存储。 You should calculate things as you need them.您应该根据需要计算事物。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM