List of usage examples for android.database Cursor getFloat
float getFloat(int columnIndex);
From source file:Main.java
protected static float getFloat(Cursor mCursor, String column) { return mCursor.getFloat(mCursor.getColumnIndex(column)); }
From source file:Main.java
public static float getFloat(@NonNull Cursor cursor, @NonNull String columnName) { return cursor.getFloat(cursor.getColumnIndex(columnName)); }
From source file:Main.java
static Float getFloatOrNull(int columnIndex, Cursor cursor) { return cursor.isNull(columnIndex) ? null : cursor.getFloat(columnIndex); }
From source file:Main.java
public static float floatFromCursor(Cursor c, String field) { if (c.isNull(c.getColumnIndex(field))) { return -1; }// ww w. ja va 2 s .c o m return c.getFloat(c.getColumnIndex(field)); }
From source file:Main.java
public static float getCursorFloat(Cursor cursor, String name) { if (isCursorEmpty(cursor)) { return 0; } else {//from w w w . j a va 2 s .co m return cursor.getFloat(cursor.getColumnIndex(name)); } }
From source file:Main.java
public static void keep_setFloat(Field field, Object obj, Cursor cursor, int i) { try {// ww w . ja v a 2 s .c o m if (field.getType().equals(Float.TYPE)) field.setFloat(obj, cursor.getFloat(i)); else field.set(obj, Float.valueOf(cursor.getFloat(i))); } catch (Exception exception) { exception.printStackTrace(); } }
From source file:Main.java
/** * Get the cursor/*from w w w . j a v a 2s . c o m*/ * @param cursor Cursor from where read value * @param index int to read * @return Object read */ private static Object getCursorValue(Cursor cursor, int index) { switch (cursor.getType(index)) { case Cursor.FIELD_TYPE_INTEGER: return Integer.valueOf(cursor.getInt(index)); case Cursor.FIELD_TYPE_FLOAT: return Float.valueOf(cursor.getFloat(index)); case Cursor.FIELD_TYPE_STRING: return cursor.getString(index); case Cursor.FIELD_TYPE_BLOB: return cursor.getBlob(index); default: return null; } }
From source file:Main.java
public static float getFloatFromCursor(Cursor cursor, String columnName) { float value = -1; if (cursor != null && cursor.getPosition() >= 0 && cursor.getPosition() < cursor.getCount()) { int columnIndex = cursor.getColumnIndex(columnName); if (columnIndex >= 0) { value = cursor.getFloat(columnIndex); }//w ww .j av a2 s . c o m } return value; }
From source file:Main.java
static Object getObject(Cursor cursor, int columnIndex) throws Exception { int type = getType(cursor, columnIndex); Object value;//from w ww.j a v a 2 s . co m switch (type) { case Cursor.FIELD_TYPE_BLOB: value = cursor.getBlob(columnIndex); break; case Cursor.FIELD_TYPE_FLOAT: value = cursor.getFloat(columnIndex); break; case Cursor.FIELD_TYPE_INTEGER: value = cursor.getLong(columnIndex); break; case Cursor.FIELD_TYPE_NULL: value = null; break; case Cursor.FIELD_TYPE_STRING: value = cursor.getString(columnIndex); break; default: value = cursor.getString(columnIndex); } return value; }
From source file:com.appsimobile.appsii.module.HotspotLoader.java
public static CircularArray<HotspotItem> loadHotspots(Context c) { ContentResolver r = c.getContentResolver(); Cursor cursor = r.query(HomeContract.Hotspots.CONTENT_URI, HotspotQuery.PROJECTION, null, null, null); if (cursor != null) { CircularArray<HotspotItem> result = new CircularArray<>(cursor.getCount()); try {// w w w . j a va 2 s . co m while (cursor.moveToNext()) { long id = cursor.getLong(HotspotQuery.ID); float height = cursor.getFloat(HotspotQuery.HEIGHT); float ypos = cursor.getFloat(HotspotQuery.Y_POSITION); boolean left = cursor.getInt(HotspotQuery.LEFT_BORDER) == 1; boolean needsConfiguration = cursor.getInt(HotspotQuery.NEEDS_CONFIGURATION) == 1; long defaultPageId = cursor.isNull(HotspotQuery._DEFAULT_PAGE) ? -1L : cursor.getLong(HotspotQuery._DEFAULT_PAGE); String name = cursor.getString(HotspotQuery.NAME); HotspotItem conf = new HotspotItem(); conf.init(id, name, height, ypos, left, needsConfiguration, defaultPageId); result.addLast(conf); } } finally { cursor.close(); } return result; } return CollectionUtils.emptyArray(); }