Skip to content Skip to sidebar Skip to footer

Sqlitedatabase Cursor Empty Only On Android 5.0+ Devices

The application has a SearchView which fetches suggestions from a specific database table. Everything worked without any errors until Android 5.0 appeared. As of then, when the SQ

Solution 1:

Answered https://stackoverflow.com/a/30710226/437039 by laalto

MATCH '*foo*' queries never worked correctly in any version of sqlite. The fact that you got some results earlier was just a coincidence. Just the prefix form MATCH 'foo*' (and MATCH 'foo') are supported.

Lollipop ships with a newer version of sqlite. For detailed list of changes between sqlite versions, see the changelog.

Solution 2:

Have you tried to query using the SQLiteDatabase query method like the following?

String selection = "fts" + " =? AND " +

 String[] selectionArgs = newString [] {
                "*e*"
        };
 String[] projection = newString [] { "rowId", "suggested_text"};
 SQLiteDatabase db = mDbHelper.getReadableDatabase();
 Cursor cursor = db.query("tableName",
                projection,selection, selectionArgs, null, null, null);

Post a Comment for "Sqlitedatabase Cursor Empty Only On Android 5.0+ Devices"