Nel mio database, ho un paio di campi "reali".non può convertire da double a float
Heres la struttura:
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"
+ ")");
Ora quello che sto cercando di fare è calcolare dell'1RM modo che io possa inserire nel database.
Qui è la mia funzione finora:
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;
}
Sono bloccato qui. Mi sta dando l'errore "Impossibile convertire da doppio a float" per onerm
. Ho provato a lanciare il peso come un float usando (Float) di fronte ad esso, ho provato a usare weight.floatValue() e niente sembra funzionare.
Questa cosa non funziona per me .. –