In my database, I have a couple of "real" fields.
Heres the structure:
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"
+ ")");
Now what I am trying to do is calculate 1RM so that I can insert it into the database.
Here is my function so far:
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;
}
I am stuck here. It is giving me the error "cannot convert from double to float" for onerm
. I've tried casting the weight as a float by using (Float) in front of it, I've tried using weight.floatValue() and nothing seems to work.
Have you tried this?
float onerm = (float) (weigth/(1.0278-(.0278*reps)));