搜索建议结果显示为空白/没有文本空白、文本、建议、结果

由网友(烟花易冷人易散)分享简介:我已经在我的活动,工​​作正常包括一个搜索对话框。但是添加搜索建议给了我一个小问题:搜索建议条目是空。 I have included a Search Dialog in my Activity which works fine. However adding Search Suggestions gives me...

我已经在我的活动,工​​作正常包括一个搜索对话框。但是添加搜索建议给了我一个小问题:搜索建议条目是空。

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".

我可以看到我的内容提供商被调用(查询(..)),我返回MatrixCursor有几排。该建议名单也显示了(点击)项 - 但均为空。空白,如果字符串我返回SUGGEST_COLUMN_TEXT_1和SUGGEST_COLUMN_TEXT_2,其中一个空字符串。

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.

我在MatrixCursor使用的列是:

The columns I use in the MatrixCursor are:

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

我也尝试只用_ID和SUGGEST_COLUMN_TEXT_1列,但同样的结果。

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

编辑:我试图返回的从我的数据有些是简单的测试字符串作为SUGGEST_COLUMN_TEXT_1而不是

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

我注意到搞不清code是与此有关,所以请索要任何可能需要摸不着头脑。

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.

感谢

(我想添加一个Android的搜索建议的标签,但我newguy这样看来我广东话)

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

推荐答案

(谢谢你,Jcwenger教新来的家伙: - )

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

解决方案,从上面我的评论:

The solution, from my comment above:

发现了它。使用SearchManager.SUGGEST_COLUMN_TEXT_1而不是SUGGEST_COLUMN_TEXT_1。(同为休息).The字符串SearchManager.SUGGEST_COLUMN_TEXT_1映射到suggest_text_1:http://developer.android.com/reference/android/app/SearchManager.html#SUGGEST_COLUMN_TEXT_1

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

阅读全文

相关推荐

最新文章