IllegalArgumentException: the bind value at index 1 is null IllegalArgumentException: the bind value at index 1 is null android android

IllegalArgumentException: the bind value at index 1 is null


The bind value apparently refers to the selectionArgs for the selection, that you insert into query(). If such a selectionArgs value is null, you get this.


@Gray and @pjv response was the point for realize what problem caused this error. You have to be careful with selection and selectionArgs matching, if you pass selection = null and selectionArgs = something, you will get this error too! :) Thnks!


This does not exactly relate to the question, but I was facing a similiar issue for me the argument containted a dash (-) at the beginning. This was causing the issue.

So I escaped the argument like this

return mDatabase.query(table_name,                       null,                       column_name + "=?",                       new String[]{"\\" + argument},                       null,                       null,                       null);

This solved it for me.

You can also see this : How to escape special characters like ' in sqlite in android