0

First some background.

In my edit item activity I have added search functionality to change of one of the item's data fields. (Its manufacturer and make). Since the user can select from quite a large amount of items, we have decided to use search with suggestions to change the manufacturer/model.

Using the normal Android search, from the edit activity I can override the onSearchRequested() method and add the current item's ID as part of the extra data. The actual updating of the data item, is done in the search activity. (I know, not the best idea, but my edit activity doesn't know what the user did in the search activity.)

This works fine for a simple search, but I can't seem to find a place to inject this context data (the item's id) for Search Suggestions.

I have read through the android docs and the closest I have come across is SUGGEST_COLUMN_INTENT_EXTRA_DATA column for the resultant row in my suggestion, but since my search content provider also doesn't have any context of what item I am editing, it doesn't seem like it will solve my problem. The Intent is still launched from the suggestion by the Android system, and I can't seem to get the required context info added to it.

Is this even possible given that search suggestions seems to be geared towards context-less global searches i.e. Android's quick search?

For completeness sake: we are targeting platforms less than Android 3.0, so the functionality of SearchView is not available.

4

1 回答 1

0

好消息:建议直接启动的 Intent 与活动在对“onSearchRequested()”的调用中设置的 Intent 相同。任何上下文信息都可以在那里设置。任何人都可以在文档中找到对此的参考吗?

于 2012-04-30T10:17:17.953 回答