Книга: Beginning Android

Hunting Season

Hunting Season

There are two types of search in Android: local and global. Local search searches within the current application; global search searches the Web via Google’s search engine. You can initiate either type of search in a variety of ways, including the following:

• You can call onSearchRequested() from a button or menu choice, which will initiate a local search (unless you override this method in your activity).

• You can directly call startSearch() to initiate a local or global search, including optionally supplying a search string to use as a starting point.

• You can elect to have keyboard entry kick off a search via setDefaultKeyMode(), for either local search (setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL)) or global search (setDefaultKeyMode(DEFAULT_KEYS_SEARCH_GLOBAL)).

In either case, the search appears as a set of UI components across the top of the screen, with your activity blurred underneath it (see Figures 36-1 and 36-2).


Figure 36-1. The Android local search pop-up


Figure 36-2. The Android global search pop-up, showing a drop-down with previous searches

Оглавление книги

Оглавление статьи/книги

Генерация: 1.682. Запросов К БД/Cache: 3 / 1
поделиться
Вверх Вниз