I've got the Android Search Dialog working, but the issue I'm having is that I have a 3 column DB table where I'd like all 3 columns to be searched. The below method only performs a search on Column 1 of the table:
//--- GET RECORDS FOR SEARCH
public Cursor searchDB(String query) {
String[] allColumns = new String[]{ KEY_COLUMN1, KEY_COLUMN2, KEY_COLUMN3 };
return db.query(true, DB_TABLE, new String[] { KEY_ROWID,
KEY_COLUMN1, KEY_COLUMN2, KEY_COLUMN3 }, KEY_COLUMN1 + " LIKE" + "'%" + query + "%'", null, null, null, null, null);
}
//--- END Get Records for Search
So I tried adding a string array to the query like this:
//--- GET RECORDS FOR SEARCH
public Cursor searchDB(String query) {
String[] allColumns = new String[]{ KEY_COLUMN1, KEY_COLUMN2, KEY_COLUMN3 };
return db.query(true, DB_TABLE, new String[] { KEY_ROWID,
KEY_COLUMN1, KEY_COLUMN2, KEY_COLUMN3 }, allColumns + " LIKE" + "'%" + query + "%'", null, null, null, null, null);
}
//--- END Get Records for Search
but that crashes the app. So how can the method be modified to search three columns (Column1, Column2, and Column3)?