Android Search In Pictures
satya - Tuesday, October 20, 2009 10:06:41 AM
A pristine home page
satya - Tuesday, October 20, 2009 10:10:05 AM
key elements
You can see Quick Search Box at the top. You can start entering searches there directly.
You can invoke search also through the magnifying glass icon on the right hand side menu button group.
you can use this search button on the right any time in your device experience.
If there is an activity then this button will bring the search as directed by that activity. This will be either local search or a global search.
satya - Tuesday, October 20, 2009 10:10:47 AM
Zero Suggestions mode
satya - Tuesday, October 20, 2009 10:12:30 AM
key elements
If you don't type anything in the search box, the system is capable of displaying a list of applicable things based on previous searches. In this case I have invoked the spare parts application through a search. The system determined that it is reasonable to go there again and hence suggested the app.
This provision is available for all your applications to suggest.
satya - Tuesday, October 20, 2009 10:13:04 AM
Searching for an "a"
satya - Tuesday, October 20, 2009 10:14:46 AM
key elements
I have typed "a" to start the search. At this time the cursor is in the search box, none of the options are high lighted due to moving arrow buttons. In this mode half the screen is filled with suggestions and the other half is taken by the key board. In the next screen you will see what happens if you use the arrow down key to move through the suggestions.
satya - Tuesday, October 20, 2009 10:16:55 AM
Fully exposed search
satya - Tuesday, October 20, 2009 10:19:06 AM
key elements
In this case, I have used the move down arrow to go through the list of suggestions. As soon as this happens Android will remove the keyboard and fill the whole page with suggestions. It will put the keyboard back if you were to navigate back to the edit control.
satya - Tuesday, October 20, 2009 10:19:46 AM
A populated suggestion
satya - Tuesday, October 20, 2009 10:21:44 AM
key elements
Notice what happens when the move down button take you to an item like above. In this case Android took the suggestion and populated the search box. Now you have the option of selecting the search button at the top or directly clicking on the suggestion itself.
Notice that the letter "a" is replaced by the suggestion text in the search edit box.
satya - Tuesday, October 20, 2009 10:22:20 AM
Invoking an application through search
satya - Tuesday, October 20, 2009 10:23:40 AM
key elements
Notice how pointing to an application suggestion does not change the search box. Now two things can happen.
If you click on the search icon (magnifying glass) next to the search box, google browser will be launched.
if you click on the application name item in the suggestion list then the application will be launched.
satya - Tuesday, October 20, 2009 10:24:10 AM
search through the browser
satya - Tuesday, October 20, 2009 10:24:50 AM
key elements
Notice how finally when I clicked the magnifying glass with an "a" in the text box, it launched the browser and searched for contents.
satya - Wednesday, October 21, 2009 11:16:32 AM
Here are a series of pictures you would use to enable your app for suggestions
Your application can participate in the global search box as well. It does this by registering a suggestion provider. Once such an application is installed, as a user you will need to enable the application to participate in the suggestions. By default you will not see the suggestions from this application. You can use the following figures to accomplish this.
satya - Wednesday, October 21, 2009 11:17:50 AM
Here is how you access Android settings
You can get to this screen by clicking on Home and then clicking on the arrow up at the bottom. This is essentially the list of apps on your phone.
satya - Wednesday, October 21, 2009 11:19:02 AM
Here is what you see when you click on settings
Nothing terribly special the menu previous will lead to this view on which you will select the "search"
satya - Wednesday, October 21, 2009 11:20:00 AM
Here is the search settings view
You will now need to click on the searchable items menu.
satya - Wednesday, October 21, 2009 11:21:18 AM
This will bring up a list of searchable apps
You will see the list of available apps here. See the grayed out app here called "Test Harness 1". This is the app I have installed. By default it is not enabled as you can see from the grayed out menu.
satya - Wednesday, October 21, 2009 11:21:51 AM
Here is what it looks like when you click on it to enable it
satya - Wednesday, October 21, 2009 11:22:45 AM
Well tell me now how my suggestions will show up in the global search
The next sequence of images will show you how the suggestions from this app "Test Harness 1" will show up in the global search box.
satya - Wednesday, October 21, 2009 11:24:43 AM
Androi search exposes the additional suggestions as a more results suggestion item
Notice that multiple suggestions from mutltiple apps are put together into a single line. At this level you won't see the individual suggestions from each app. You have to click on it to expand it.
satya - Wednesday, October 21, 2009 11:25:56 AM
More results expanded
See how the light gray background expanded the list. Now you see the individual items, still combined, under each app. You will have to choose your app to see the real items.
satya - Wednesday, October 21, 2009 11:27:18 AM
Your application specific suggestions
Notice that these suggestions are now dedicated to your app. Any action on this view will invoke your specific search activity.
satya - Wednesday, October 21, 2009 11:28:56 AM
If you were to invoke the search while your activity is in view (local search)
This is what you would see if you were to click the search button while your activity is in focus. Android will invoke the local search along with local suggestions. This is also assuming that your activity has opted for a local search and not a global one.
satya - Wednesday, October 28, 2009 10:16:32 AM
How activities interact with the search key
The following figures will focus on demonstrating how regular activities interact with the search key. In other words, what happens when you click on search when you are viewing an activity.
I will cover the following types activities.
I will start with a regular activity that is unaware of any search. I will examine what happens when the search key is pressed when this activity is the current activity in focus.
Then I will try an activity that explicitly disables search and see how the search key behaves.
I will then look at an activity which is configured for local search. I will see what happens when the search key is pressed when this activity is in focus.
Here are the annotated figures exploring these scenarios.
satya - Wednesday, October 28, 2009 10:18:05 AM
Here is a simple regular activity that is unaware of search
satya - Wednesday, October 28, 2009 10:19:27 AM
Here is an example of the invoked global search
satya - Wednesday, October 28, 2009 10:19:56 AM
I use the following menus to navigate to the other activities
satya - Wednesday, October 28, 2009 10:22:03 AM
Let us see the No Search or Search Disabled activity
As the comment suggests if you press the search key NOTHING-HAPPENS. This is because the activity has returned false from the onSearchRequested() function of this activity.
satya - Wednesday, October 28, 2009 10:30:05 AM
Here is an activity that explicitly invokes the global search using a menu item
This activity is not specialized in any way. It is a standard regular activity except that I created a menu option called "Search". I could have used any text I would have wanted.
when this menu item is chosen Android will invoke the global search. Here is the code that does it.
if (item.getItemId() == R.id.mid_si_search)
{
this.onSearchRequested();
return true;
}
satya - Wednesday, October 28, 2009 10:50:13 AM
Here is an activity which specifies that there is a local search option available
satya - Wednesday, October 28, 2009 10:52:47 AM
Here is how it goes about declaring that there is a local search
<activity android:name=".LocalSearchEnabledActivity"
android:label="Activity/QSB Interaction::Local Search">
<meta-data android:name="android.app.default_searchable"
android:value=".SearchActivity" />
</activity>
Notice how the LocalSearchEnabledActivity indicates that there is an activity called SearchActivity that can respond to searches. we will see shortly what this searchactivity is.
satya - Wednesday, October 28, 2009 10:56:10 AM
Local Search: what happens now when the search key is pressed
when the previous activity is in view and user presses the search key you will see this local search dialog shows up. You can recognize this local aspect by looking at the label of this search dialog and also the hint in the QSB edit box.
If you type something in here and click the search icon you will be taken to the above specified SearchActivity which you will see in the next figure.
satya - Wednesday, October 28, 2009 10:58:03 AM
Search Results Activity
Android is the one that invokes this activity by passing the query text. To make this happen this search activity should have two definitions. One in the manifest file and one in the xml sub directory. You will see them next
satya - Wednesday, October 28, 2009 10:59:27 AM
SearchActivity in the manifest file
<activity android:name=".SearchActivity"
android:label="Activity/QSB Interaction::Search Results">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="@xml/searchable" />
</activity>
satya - Wednesday, October 28, 2009 11:00:28 AM
Here is the searchable xml file
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="@string/search_label"
android:hint="@string/search_hint"
android:searchMode="showSearchLabelAsBadge"
/>
Notice the serch label and search hint.