List of usage examples for android.database Cursor getDouble
double getDouble(int columnIndex);
From source file:Main.java
public static double getDouble(String columnName, Cursor cursor) { return cursor.getDouble(cursor.getColumnIndexOrThrow(columnName)); }
From source file:Main.java
public static double getDouble(Cursor cursor, String columnName) { return cursor.getDouble(cursor.getColumnIndexOrThrow(columnName)); }
From source file:Main.java
public static double getDouble(@NonNull Cursor cursor, @NonNull String columnName) { return cursor.getDouble(cursor.getColumnIndex(columnName)); }
From source file:Main.java
static Double getDoubleOrNull(int columnIndex, Cursor cursor) { return cursor.isNull(columnIndex) ? null : cursor.getDouble(columnIndex); }
From source file:Main.java
public static double doubleFromCursor(Cursor c, String field) { if (c.isNull(c.getColumnIndex(field))) { return -1; }//from w w w . ja v a 2s. c om return c.getDouble(c.getColumnIndex(field)); }
From source file:org.fitchfamily.android.wifi_backend.ui.data.WifiDetailFragment.java
private static boolean hasSample(Cursor cursor, int index) { return cursor.getDouble(index) != 0.d || cursor.getDouble(index + 1) != 0.d; }
From source file:de.stadtrallye.rallyesoft.util.converters.CursorConverters.java
public static Task getTask(Cursor cursor, TaskCursorIds c) { LatLng coords;/* w ww. j a va 2 s. co m*/ coords = (cursor.isNull(c.latitude) || cursor.isNull(c.longitude)) ? null : new LatLng(cursor.getDouble(c.latitude), cursor.getDouble(c.longitude)); try { List<AdditionalResource> res = null; String addRes = cursor.getString(c.additionalResources); if (addRes != null) { try { res = Serialization.getJsonInstance().readValue(addRes, new TypeReference<List<AdditionalResource>>() { }); } catch (JsonProcessingException e) { Log.e("CursorConverters", "Could not read additional resources: " + addRes, e); } } return new Task(cursor.getInt(c.id), getBoolean(cursor, c.locationSpecific), coords, cursor.getDouble(c.radius), cursor.getString(c.name), cursor.getString(c.description), getBoolean(cursor, c.multiple), cursor.getInt(c.submitType), cursor.getString(c.points), res); } catch (IOException e) { Log.e("Task Cursor Converter", "Json deserialization failed", e); return null; } }
From source file:edu.mit.mobile.android.locast.data.Locatable.java
public static Uri toGeoUri(Cursor c) { if (c.isNull(c.getColumnIndex(Columns._LATITUDE)) || c.isNull(c.getColumnIndex(Columns._LONGITUDE))) { return null; }/*from ww w.j av a 2 s. co m*/ return Uri.parse("geo:" + c.getDouble(c.getColumnIndex(Columns._LATITUDE)) + "," + c.getDouble(c.getColumnIndex(Columns._LONGITUDE))); }
From source file:edu.mit.mobile.android.locast.data.interfaces.LocatableUtils.java
/** * Fills the result array with the current location. * * @param c/*from w w w . j a v a 2 s. c o m*/ * cursor pointing to row to get location of * @param result * output array. Must have 2 or more elements. Latitude is in index 0. */ public static void toLocationArray(Cursor c, int latColumn, int lonColumn, double[] result) { if (c.isNull(latColumn) || c.isNull(lonColumn)) { return; } result[0] = c.getDouble(latColumn); result[1] = c.getDouble(lonColumn); }
From source file:edu.mit.mobile.android.locast.data.interfaces.LocatableUtils.java
/** * Get the latitude/longitude from the row currently selected in the cursor. Requires * LocatableUtils.Locatable._LATITUDE and LocatableUtils.Locatable._LONGITUDE to be selected. * * @param c// w w w . ja va 2 s. c o m * @return */ public static Location toLocation(Cursor c, int latColumn, int lonColumn) { if (c.isNull(latColumn) || c.isNull(lonColumn)) { return null; } final Location l = new Location("internal"); l.setLatitude(c.getDouble(latColumn)); l.setLongitude(c.getDouble(lonColumn)); return l; }