Exemplo n.º 1
0
  private static ContentValues getContentValues_goal(Goal goal) {
    ContentValues values = new ContentValues();

    values.put(Schema.GoalTable.Cols.STATUS, goal.getStatus().toString());
    values.put(Schema.GoalTable.Cols.PROGRESS, goal.getProgress());
    values.put(Schema.GoalTable.Cols.NAME, goal.getName());

    return values;
  }
Exemplo n.º 2
0
  // returns the current progress of the goal of given name
  public int checkProgress(String name) {

    int progress = 0;

    try (DatabaseCursorWrapper wrapper = queryGoal("NAME=?", new String[] {name})) {
      wrapper.moveToFirst();

      while (!wrapper.isAfterLast()) {
        Goal goal = wrapper.getGoal();
        progress = goal.getProgress();
        wrapper.moveToNext();
      }
    }

    return progress;
  }