public UserProfile(Cursor cursor) { username = cursor.getString(cursor.getColumnIndex("username")); try { dob = new SimpleDateFormat("yyyy-MM-dd").parse(cursor.getString(cursor.getColumnIndex("dob"))); } catch (ParseException e) { Log.e("UserProfile", e.getMessage()); } setGender(cursor.getString(cursor.getColumnIndex("gender"))); height = cursor.getDouble(cursor.getColumnIndex("height")); weight = cursor.getDouble(cursor.getColumnIndex("weight")); activityLevel = cursor.getDouble(cursor.getColumnIndex("activityLevel")); calories = cursor.getDouble(cursor.getColumnIndex("calories")); goal = cursor.getDouble(cursor.getColumnIndex("goal")); mode = GoalMode.valueOf(cursor.getString(cursor.getColumnIndex("mode"))); dirty = cursor.getShort(cursor.getColumnIndex("dirty")) > 0; }
public void setMode(String string) { this.mode = GoalMode.valueOf(string.toUpperCase()); }