搜索建议结果显示为空白/没有文本 [英] Search Suggestion results displayed as blank/no text

查看:135
本文介绍了搜索建议结果显示为空白/没有文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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:<一href="http://developer.android.com/reference/android/app/SearchManager.html#SUGGEST_COLUMN_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

这篇关于搜索建议结果显示为空白/没有文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆