Android examples for Database:SQLite Version
Get installed SQLite version as string.
//package com.java2s; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; public class Main { private static String mSQLiteVersion = null; /**//from ww w .ja v a 2 s . c om * Get installed SQLite version as string. * * @return installed SQLite version as string (e.g. {@code "3.5.9"}) */ public static String getSQLiteVersion() { if (mSQLiteVersion == null) { SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase( ":memory:", null); Cursor cursor = db.rawQuery( "select sqlite_version() AS sqlite_version", null); mSQLiteVersion = ""; while (cursor.moveToNext()) { mSQLiteVersion += "." + cursor.getString(0); } if (mSQLiteVersion.startsWith(".")) { mSQLiteVersion = mSQLiteVersion.substring(1); } cursor.close(); db.close(); } return mSQLiteVersion; } }