Example usage for android.database.sqlite SQLiteCursor getColumnIndexOrThrow

List of usage examples for android.database.sqlite SQLiteCursor getColumnIndexOrThrow

Introduction

In this page you can find the example usage for android.database.sqlite SQLiteCursor getColumnIndexOrThrow.

Prototype

@Override
    public int getColumnIndexOrThrow(String columnName) 

Source Link

Usage

From source file:com.gmail.taneza.ronald.carbs.myfoods.MyFoodsEditableFragment.java

private FoodItem getFoodItemAtPosition(ListView l, int position) {
    SQLiteCursor cursor = (SQLiteCursor) l.getItemAtPosition(position);

    return new FoodItem(cursor.getString(cursor.getColumnIndexOrThrow(FoodDbAdapter.COLUMN_TABLE_NAME)),
            cursor.getInt(cursor.getColumnIndexOrThrow(FoodDbAdapter.MYFOODS_COLUMN_ID)),
            cursor.getInt(cursor.getColumnIndexOrThrow(FoodDbAdapter.MYFOODS_COLUMN_QUANTITY_PER_UNIT)));
}