Android examples for Database:SQL Query
query Scalar Long from database sql query
//package com.java2s; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; public class Main { public static Long queryScalarLong(SQLiteDatabase database, String sql) { Cursor cursor = database.rawQuery(sql, null); if (cursor.moveToFirst()) { Long val = cursor.isNull(0) ? null : cursor.getLong(0); cursor.close();/*from ww w . j av a 2s .c o m*/ return val; } cursor.close(); return null; } }