The correct syntax for using the IN operator in Android ContentProvider is as follows:
cursor = database.query(contentUri, projection, "columname IN(?,?)", new String[]{"value1" , "value2"}, sortOrder);
Alternatively, we can also use
cursor = database.query(contentUri, projection, "columnName IN(?)", new String[] {" 'value1' , 'value2' "}, sortOrder);
Note that we need single quotes around each value, separated by commas, in the arguments for the second case, otherwise the whole row will be considered as one value for the column. SQL will consider it as
SELECT * FROM table WHERE columnName IN ('value1, value2')
instead of the correct syntax
SELECT * FROM table WHERE columnName IN ('value1', 'value2')
source share