public static Ingredient fromCursor(Cursor cursor){
  Ingredient ingredient=new Ingredient();
  for (int c=0; c < cursor.getColumnCount(); c++) {
    String columnName=cursor.getColumnName(c);
    if (columnName.equals(RecipeIngredientTable.AMOUNT_COLUMN)) {
      ingredient.setAmount(cursor.getString(c));
    }
 else     if (columnName.equals(RecipeIngredientTable.DESCRIPTION_COLUMN)) {
      ingredient.setDescription(cursor.getString(c));
    }
  }
  return ingredient;
}

public static Ingredient fromCursor ( Cursor cursor ) { Ingredient ingredient = new Ingredient ( ) ; for ( int c = 0 ; c < cursor . getColumnCount ( ) ; c ++ ) { String columnName = cursor . getColumnName ( c ) ; if ( columnName . equals ( RecipeIngredientTable . AMOUNT_COLUMN ) ) { ingredient . setAmount ( cursor . getString ( c ) ) ; } else if ( columnName . equals ( RecipeIngredientTable . DESCRIPTION_COLUMN ) ) { ingredient . setDescription ( cursor . getString ( c ) ) ; } } return ingredient ; }
static helper method for populating attributes from a database cursor .
