Android examples for Database:Cursor Column
Return the int stored in the specified column of the cursor, -1 if column does not exist
import java.io.Closeable; import java.io.IOException; import android.database.Cursor; public class Main{ /** Return the int stored in the specified column of the cursor, -1 if column does not exist */ public static int getInt(Cursor cursor, DatabaseColumn column) { int index = cursor.getColumnIndex(column.getName()); return (index != -1) ? cursor.getInt(index) : index; }//from w ww.jav a2 s.com }