开发者

Android: SearchBox -> fill hint list dynamically with data received via HTTP/JSON

I've been looking into the Android SDK's example of the SearchableDictionary for a while now, but I'm still not sure if that is the right approach.

The problem is, that I want to fill my hint list (see picture below) with data, which I will receive via a HTTP/JSON query. So I'm not sure if using a Conte开发者_运维知识库ntProvider as used in the above example is the right thing to do. Can I access the hint list of the SearchBox in some way more direct?

Android: SearchBox -> fill hint list dynamically with data received via HTTP/JSON


You can overload the onSearchRequested for the searchmanager and return a custom data set the the given query. make sure to use an asyncTask if you are connecting to the web for your data to avoid ANR's

 @Override
 public boolean onSearchRequested() {
     Bundle appData = new Bundle();
     appData.put...();
     ...
     startSearch(null, false, appData);
     return true;
 }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜