Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search Suggestion results displayed as blank/no text

I have included a Search Dialog in my Activity which works fine. However adding Search Suggestions gives me a little problem: The search suggestion entries are "empty".

I can see my content provider gets called (query(..)) and I return a MatrixCursor with several rows. The suggestions list also shows with (clickable) entries -- but are all blank. Blank as if the string I returned for SUGGEST_COLUMN_TEXT_1 and SUGGEST_COLUMN_TEXT_2 where an empty string.

The columns I use in the MatrixCursor are:

String[] columnNames = {"_ID", "SUGGEST_COLUMN_TEXT_1", "SUGGEST_COLUMN_TEXT_2", "SUGGEST_COLUMN_INTENT_EXTRA_DATA"};

I did try with just the _ID and SUGGEST_COLUMN_TEXT_1 column but same result.

EDIT: And I tried returning a simple "test" string as SUGGEST_COLUMN_TEXT_1 instead of something from my data.

I'm note quite sure what code is relevant here, so please ask for whatever may be needed to figure this out.

I have no idea for where to look for this bug, and my Google-Fu has failed me.

Thanks

(I would like to have added an 'android-search-suggestion' tag, but I'm newguy so it seems I cant)

like image 703
MSurrow Avatar asked Jul 31 '11 11:07

MSurrow


1 Answers

(Thank you, Jcwenger for teaching the new guy :-)

The solution, from my comment above:

Found it. Use SearchManager.SUGGEST_COLUMN_TEXT_1 instead of "SUGGEST_COLUMN_TEXT_1".. (Same for the rest).The String SearchManager.SUGGEST_COLUMN_TEXT_1 maps to "suggest_text_1": http://developer.android.com/reference/android/app/SearchManager.html#SUGGEST_COLUMN_TEXT_1

like image 162
MSurrow Avatar answered Oct 25 '22 00:10

MSurrow