Reputation: 36
I am having problems with my customizable search button. I am able to successfully query the database, but unforunately nothing shows up as a result. I do know that the result does show up because when I add/delete text from the search bar, the results to change (because the size of the list grows/shrinks as when bein to search).Does anyone have any solution as to why this is happening? I modified the 2.1 Dictionary example provided by Android.
Thanks George
Upvotes: 0
Views: 365
Reputation: 11
Try to put something like this in your ContentProvider's query() method:
String[] columns = {
BaseColumns._ID,
SearchManager.SUGGEST_COLUMN_TEXT_1,
SearchManager.SUGGEST_COLUMN_INTENT_DATA };
MatrixCursor cursor = new MatrixCursor(columns);
for (int i = 0; i < arr.length(); i++) {
String[] tmp = {Integer.toString(i), arr.getString(i), arr.getString(i)};
cursor.addRow(tmp);
}
return cursor;
Upvotes: 1