在我的数据库中,我有几个“真实”字段。
继承人的结构:
database.execSQL("create table " + TABLE_LOGS + " ("
+ COLUMN_ID + " integer primary key autoincrement,"
+ COLUMN_ID_DAY_EXERCISE + " integer not null,"
+ COLUMN_REPS + " integer not null"
+ COLUMN_WEIGHT + " real not null"
+ COLUMN_1RM + " real not null"
+ COLUMN_DATE + " integer not null"
+ ")");
现在我要做的是计算 1RM 以便我可以将其插入数据库。
到目前为止,这是我的功能:
public void createLog(long id_day_exercise, float reps, long weight) {
// create 1rm
// create date timestamp
float onerm = weight/(1.0278-(.0278*reps));
long unixTime = System.currentTimeMillis() / 1000L;
}
我被困在这里。它给了我错误“无法从双精度转换为浮点数” onerm
。我尝试通过在它前面使用 (Float) 将重量转换为浮点数,我尝试使用 weight.floatValue() 并且似乎没有任何效果。