Android examples for Database:SQL Query
query Scalar Float from sql query
//package com.java2s; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; public class Main { public static Float queryScalarFloat(SQLiteDatabase database, String sql) { Cursor cursor = database.rawQuery(sql, null); if (cursor.moveToFirst()) { Float val = cursor.isNull(0) ? null : cursor.getFloat(0); cursor.close();/*w ww . jav a2 s.c om*/ return val; } cursor.close(); return null; } }