Java Code Examples for android.content.ContentValues#getAsFloat()
The following examples show how to use
android.content.ContentValues#getAsFloat() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScaleDatabaseProvider.java From openScale with GNU General Public License v3.0 | 6 votes |
@Override public Uri insert(Uri uri, ContentValues values) { Date date = new Date(values.getAsLong("datetime")); float weight = values.getAsFloat("weight"); int userId = values.getAsInteger("userId"); ScaleMeasurement scaleMeasurement = new ScaleMeasurement(); scaleMeasurement.setUserId(userId); scaleMeasurement.setWeight(weight); scaleMeasurement.setDateTime(date); ScaleMeasurementDAO measurementDAO = OpenScale.getInstance().getScaleMeasurementDAO(); if (measurementDAO.insert(scaleMeasurement) == -1) { update(uri, values, "", new String[]{}); } return null; }
Example 2
Source File: ScaleDatabaseProvider.java From openScale with GNU General Public License v3.0 | 5 votes |
@Override public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) { Date date = new Date(values.getAsLong("datetime")); float weight = values.getAsFloat("weight"); int userId = values.getAsInteger("userId"); ScaleMeasurement scaleMeasurement = new ScaleMeasurement(); scaleMeasurement.setWeight(weight); scaleMeasurement.setDateTime(date); ScaleMeasurementDAO measurementDAO = OpenScale.getInstance().getScaleMeasurementDAO(); ScaleMeasurement databaseMeasurement = measurementDAO.get(date, userId); if (databaseMeasurement != null) { databaseMeasurement.merge(scaleMeasurement); databaseMeasurement.setEnabled(true); measurementDAO.update(databaseMeasurement); return 1; } else { Timber.e("no measurement for an update found"); } return 0; }
Example 3
Source File: FloatFieldAdapter.java From opentasks with Apache License 2.0 | 4 votes |
@Override public Float getFrom(ContentValues values) { return values.getAsFloat(mFieldName); }
Example 4
Source File: FloatFieldAdapter.java From opentasks-provider with Apache License 2.0 | 4 votes |
@Override public Float getFrom(ContentValues values) { return values.getAsFloat(mFieldName); }