public static Recipe fromCursor(Cursor cursor){
  Recipe recipe=new Recipe(null);
  for (int c=0; c < cursor.getColumnCount(); c++) {
    String columnName=cursor.getColumnName(c);
    if (columnName.equals(RecipeTable.ID_COLUMN)) {
      recipe.id=cursor.getString(c);
    }
 else     if (columnName.equals(RecipeTable.TITLE_COLUMN)) {
      recipe.setTitle(cursor.getString(c));
    }
 else     if (columnName.equals(RecipeTable.DESCRIPTION_COLUMN)) {
      recipe.setDescription(cursor.getString(c));
    }
 else     if (columnName.equals(RecipeTable.PHOTO_COLUMN)) {
      recipe.setPhoto(cursor.getString(c));
    }
 else     if (columnName.equals(RecipeTable.PREP_TIME_COLUMN)) {
      recipe.setPrepTime(cursor.getString(c));
    }
  }
  return recipe;
}

public static Recipe fromCursor ( Cursor cursor ) { Recipe recipe = new Recipe ( null ) ; for ( int c = 0 ; c < cursor . getColumnCount ( ) ; c ++ ) { String columnName = cursor . getColumnName ( c ) ; if ( columnName . equals ( RecipeTable . ID_COLUMN ) ) { recipe . id = cursor . getString ( c ) ; } else if ( columnName . equals ( RecipeTable . TITLE_COLUMN ) ) { recipe . setTitle ( cursor . getString ( c ) ) ; } else if ( columnName . equals ( RecipeTable . DESCRIPTION_COLUMN ) ) { recipe . setDescription ( cursor . getString ( c ) ) ; } else if ( columnName . equals ( RecipeTable . PHOTO_COLUMN ) ) { recipe . setPhoto ( cursor . getString ( c ) ) ; } else if ( columnName . equals ( RecipeTable . PREP_TIME_COLUMN ) ) { recipe . setPrepTime ( cursor . getString ( c ) ) ; } } return recipe ; }
static helper method for populating attributes from a database cursor .
