OSDN Git Service

docs: update search dev guide with SearcView widget
authorScott Main <smain@google.com>
Tue, 8 Feb 2011 18:20:27 +0000 (10:20 -0800)
committerScott Main <smain@google.com>
Mon, 14 Mar 2011 20:27:53 +0000 (13:27 -0700)
Change-Id: Ieb0ccdb78760a3c90df2381e647463f7532b0efc

core/java/android/widget/SearchView.java
docs/html/guide/guide_toc.cs
docs/html/guide/topics/search/adding-custom-suggestions.jd
docs/html/guide/topics/search/adding-recent-query-suggestions.jd
docs/html/guide/topics/search/index.jd
docs/html/guide/topics/search/search-dialog.jd
docs/html/guide/topics/search/searchable-config.jd
docs/html/guide/topics/ui/actionbar.jd
docs/html/sdk/android-3.0.jd

index f051b77..0a0dec9 100644 (file)
@@ -54,18 +54,16 @@ import android.widget.TextView.OnEditorActionListener;
 import java.util.WeakHashMap;
 
 /**
- * Provides the user interface elements for the user to enter a search query and submit a
+ * A widget that provides a user interface for the user to enter a search query and submit a
  * request to a search provider. Shows a list of query suggestions or results, if
- * available and allows the user to pick a suggestion or result to launch into.
+ * available, and allows the user to pick a suggestion or result to launch into.
  *
- * <p>
- * <b>XML attributes</b>
- * <p>
- * See {@link android.R.styleable#SearchView SearchView Attributes},
- * {@link android.R.styleable#View View Attributes}
+ * <p>For more information, see the <a href="{@docRoot}guide/topics/search/index.html">Search</a>
+ * documentation.<p>
  *
  * @attr ref android.R.styleable#SearchView_iconifiedByDefault
  * @attr ref android.R.styleable#SearchView_maxWidth
+ * @attr ref android.R.styleable#SearchView_queryHint
  */
 public class SearchView extends LinearLayout {
 
@@ -374,6 +372,8 @@ public class SearchView extends LinearLayout {
      * in the SearchableInfo.
      *
      * @param hint the hint text to display
+     *
+     * @attr ref android.R.styleable#SearchView_queryHint
      */
     public void setQueryHint(CharSequence hint) {
         mQueryHint = hint;
@@ -389,6 +389,8 @@ public class SearchView extends LinearLayout {
      * <p>The default value is true.</p>
      *
      * @param iconified whether the search field should be iconified by default
+     *
+     * @attr ref android.R.styleable#SearchView_iconifiedByDefault
      */
     public void setIconifiedByDefault(boolean iconified) {
         if (mIconifiedByDefault == iconified) return;
index 24e4648..1259f5b 100644 (file)
             <span class="en">Search</span>
           </a></div>
           <ul>
-            <li><a href="<?cs var:toroot?>guide/topics/search/search-dialog.html">Using the Android Search Dialog</a></li>
+            <li><a href="<?cs var:toroot?>guide/topics/search/search-dialog.html">Creating a Search Interface</a></li>
             <li><a href="<?cs var:toroot?>guide/topics/search/adding-recent-query-suggestions.html">Adding Recent Query Suggestions</a></li>
             <li><a href="<?cs var:toroot?>guide/topics/search/adding-custom-suggestions.html">Adding Custom Suggestions</a></li>
             <li><a href="<?cs var:toroot?>guide/topics/search/searchable-config.html">Searchable Configuration</a></li>
index c8f06b9..02ee084 100644 (file)
@@ -17,8 +17,8 @@ parent.link=index.html
 </li>
 <li><a href="#IntentForSuggestions">Declaring an Intent for Suggestions</a>
   <ol>
-    <li><a href="#IntentAction">Declaring the Intent action</a></li>
-    <li><a href="#IntentData">Declaring the Intent data</a></li>
+    <li><a href="#IntentAction">Declaring the intent action</a></li>
+    <li><a href="#IntentData">Declaring the intent data</a></li>
   </ol>
 </li>
 <li><a href="#HandlingIntent">Handling the Intent</a></li>
@@ -47,8 +47,8 @@ Dictionary</a></li>
 </div>
 </div>
 
-<p>When using the Android search dialog, you can provide custom search suggestions that are
-created from data in your application. For example, if your application is a word
+<p>When using the Android search dialog or search widget, you can provide custom search suggestions
+that are created from data in your application. For example, if your application is a word
 dictionary, you can suggest words from the
 dictionary that match the text entered so far. These are the most valuable suggestions, because you
 can effectively predict what the user wants and provide instant access to it. Figure 1 shows
@@ -58,9 +58,8 @@ an example of a search dialog with custom suggestions.</p>
 Search Box, providing access to your content from outside your application.</p>
 
 <p>Before you begin with this guide to add custom suggestions, you need to have implemented the
-Android search dialog for searches in your
-application. If you haven't, see <a href="search-dialog.html">Using the Android Search
-Dialog</a>.</p>
+Android search dialog or a search widget for searches in your
+application. If you haven't, see <a href="search-dialog.html">Creating a Search Interface</a>.</p>
 
 
 <h2 id="TheBasics">The Basics</h2>
@@ -71,11 +70,11 @@ Dialog</a>.</p>
 search suggestions.</p>
 </div>
 
-<p>When the user selects a custom suggestion, the Search Manager sends an {@link
+<p>When the user selects a custom suggestion, the Android system sends an {@link
 android.content.Intent} to
-your searchable Activity. Whereas a normal search query sends an Intent with the {@link
+your searchable activity. Whereas a normal search query sends an intent with the {@link
 android.content.Intent#ACTION_SEARCH} action, you can instead define your custom suggestions to use
-{@link android.content.Intent#ACTION_VIEW} (or any other Intent action), and also include data
+{@link android.content.Intent#ACTION_VIEW} (or any other intent action), and also include data
 that's relevant to the selected suggestion. Continuing
 the dictionary example, when the user selects a suggestion, your application can immediately
 open the definition for that word, instead of searching the dictionary for matches.</p>
@@ -83,8 +82,8 @@ open the definition for that word, instead of searching the dictionary for match
 <p>To provide custom suggestions, do the following:</p>
 
 <ul>
-  <li>Implement a basic searchable Activity, as described in <a
-href="search-dialog.html">Using the Android Search Dialog</a>.</li>
+  <li>Implement a basic searchable activity, as described in <a
+href="search-dialog.html">Creating a Search Interface</a>.</li>
   <li>Modify the searchable configuration with information about the content provider that
 provides custom suggestions.</li>
   <li>Build a table (such as in an {@link android.database.sqlite.SQLiteDatabase}) for your
@@ -96,22 +95,21 @@ in your manifest.</li>
 suggestion (including a custom action and custom data). </li>
 </ul>
 
-<p>Just like the Search Manager displays the search dialog, it also displays your search
-suggestions. All you need is a content provider from which the Search Manager can retrieve your
+<p>Just as the Android system displays the search dialog, it also displays your search
+suggestions. All you need is a content provider from which the system can retrieve your
 suggestions. If you're not familiar with creating content
 providers, read the <a href="{@docRoot}guide/topics/providers/content-providers.html">Content
 Providers</a> developer guide before you continue.</p>
 
-<p>When the Search Manager identifies that your Activity is searchable and provides search
-suggestions, the following procedure takes place as soon as the user enters text into the
-search dialog:</p>
+<p>When the system identifies that your activity is searchable and provides search
+suggestions, the following procedure takes place when the user types a query:</p>
 
 <ol>
-  <li>Search Manager takes the search query text (whatever has been typed so far) and performs a
+  <li>The system takes the search query text (whatever has been typed so far) and performs a
 query to your content provider that manages your suggestions.</li>
   <li>Your content provider returns a {@link android.database.Cursor} that points to all
 suggestions that are relevant to the search query text.</li>
-  <li>Search Manager displays the list of suggestions provided by the Cursor.</li>
+  <li>The system displays the list of suggestions provided by the Cursor.</li>
 </ol>
 
 <p>Once the custom suggestions are displayed, the following might happen:</p>
@@ -120,9 +118,9 @@ suggestions that are relevant to the search query text.</li>
   <li>If the user types another key, or changes the query in any way, the above steps are repeated
 and the suggestion list is updated as appropriate. </li>
   <li>If the user executes the search, the suggestions are ignored and the search is delivered
-to your searchable Activity using the normal {@link android.content.Intent#ACTION_SEARCH}
-Intent.</li>
-  <li>If the user selects a suggestion, an Intent is sent to your searchable Activity, carrying a
+to your searchable activity using the normal {@link android.content.Intent#ACTION_SEARCH}
+intent.</li>
+  <li>If the user selects a suggestion, an intent is sent to your searchable activity, carrying a
 custom action and custom data so that your application can open the suggested content.</li>
 </ul>
 
@@ -142,7 +140,7 @@ to the {@code &lt;searchable&gt;} element in your searchable configuration file.
 &lt;/searchable&gt;
 </pre>
 
-<p>You might need some additional attributes, depending on the type of Intent you attach
+<p>You might need some additional attributes, depending on the type of intent you attach
 to each suggestion and how you want to format queries to your content provider. The other optional
 attributes are discussed in the following sections.</p>
 
@@ -155,11 +153,11 @@ providers that's covered in the <a
 href="{@docRoot}guide/topics/providers/content-providers.html">Content Provider</a> developer
 guide. For the most part, a content provider for custom suggestions is the
 same as any other content provider. However, for each suggestion you provide, the respective row in
-the {@link android.database.Cursor} must include specific columns that the Search Manager
+the {@link android.database.Cursor} must include specific columns that the system
 understands and uses to format the suggestions.</p>
 
-<p>When the user starts typing into the search dialog, the Search Manager queries your content
-provider for suggestions by calling {@link
+<p>When the user starts typing into the search dialog or search widget, the system queries
+your content provider for suggestions by calling {@link
 android.content.ContentProvider#query(Uri,String[],String,String[],String) query()} each time
 a letter is typed. In your implementation of {@link
 android.content.ContentProvider#query(Uri,String[],String,String[],String) query()}, your
@@ -170,22 +168,22 @@ android.database.Cursor} that points to the rows you have determined to be good
 two sections:</p>
 <dl>
   <dt><a href="#HandlingSuggestionQuery">Handling the suggestion query</a></dt>
-  <dd>How the Search Manager sends requests to your content provider and how to handle them</dd>
+  <dd>How the system sends requests to your content provider and how to handle them</dd>
   <dt><a href="#SuggestionTable">Building a suggestion table</a></dt>
-  <dd>How to define the columns that the Search Manager expects in the {@link
+  <dd>How to define the columns that the system expects in the {@link
 android.database.Cursor} returned with each query</dd>
 </dl>
 
 
 <h3 id="HandlingSuggestionQuery">Handling the suggestion query</h3>
 
-<p>When the Search Manager requests suggestions from your content provider, it calls your content
+<p>When the system requests suggestions from your content provider, it calls your content
 provider's {@link android.content.ContentProvider#query(Uri,String[],String,String[],String)
 query()} method. You must
 implement this method to search your suggestion data and return a
 {@link android.database.Cursor} pointing to the suggestions you deem relevant.</p>
 
-<p>Here's a summary of the parameters that the Search Manager passes to your {@link
+<p>Here's a summary of the parameters that the system passes to your {@link
 android.content.ContentProvider#query(Uri,String[],String,String[],String) query()} method
 (listed in order):</p>
 
@@ -196,7 +194,7 @@ android.content.ContentProvider#query(Uri,String[],String,String[],String) query
 content://<em>your.authority</em>/<em>optional.suggest.path</em>/<em>{@link
 android.app.SearchManager#SUGGEST_URI_PATH_QUERY}</em>
 </pre>
-<p>The default behavior is for Search Manager to pass this URI and append it with the query text.
+<p>The default behavior is for system to pass this URI and append it with the query text.
 For example:</p>
 <pre class="no-pretty-print">
 content://<em>your.authority</em>/<em>optional.suggest.path</em>/<em>{@link
@@ -233,7 +231,7 @@ about using this to <a href="#GetTheQuery">get the query</a> below.</dd>
   <dd>Always null</dd>
 </dl>
 
-<p>The Search Manager can send you the search query text in two ways. The
+<p>The system can send you the search query text in two ways. The
 default manner is for the query text to be included as the last path of the content
 URI passed in the {@code uri} parameter. However, if you include a selection value in your
 searchable configuration's {@code
@@ -251,8 +249,8 @@ parameter (a {@link android.net.Uri} object). To retrieve the query text in this
 String query = uri.getLastPathSegment().toLowerCase();
 </pre>
 
-<p>This returns the last segment of the {@link android.net.Uri}, which is the query text entered in
-the search dialog.</p>
+<p>This returns the last segment of the {@link android.net.Uri}, which is the query text entered
+by the user.</p>
 
 
 
@@ -264,7 +262,7 @@ receive everything it needs to perform the look-up and you want the
 {@code selection} and {@code selectionArgs} parameters to carry the appropriate values. In such a
 case, add the {@code android:searchSuggestSelection} attribute to your searchable configuration with
 your SQLite selection string. In the selection string, include a question mark ("?") as
-a placeholder for the actual search query. The Search Manager calls {@link
+a placeholder for the actual search query. The system calls {@link
 android.content.ContentProvider#query(Uri,String[],String,String[],String) query()} with the
 selection string as the {@code selection} parameter and the search query as the first
 element in the {@code selectionArgs} array.</p>
@@ -278,15 +276,15 @@ create a full-text search statement:</p>
     android:label="@string/app_label"
     android:hint="@string/search_hint"
     android:searchSuggestAuthority="com.example.MyCustomSuggestionProvider"
-    android:searchSuggestIntentAction="android.Intent.action.VIEW"
+    android:searchSuggestIntentAction="android.intent.action.VIEW"
     <b>android:searchSuggestSelection="word MATCH ?"</b>&gt;
 &lt;/searchable&gt;
 </pre>
 
 <p>With this configuration, your {@link
 android.content.ContentProvider#query(Uri,String[],String,String[],String) query()} method
-delivers the {@code selection} parameter as "word MATCH ?" and the {@code selectionArgs}
-parameter as whatever the user entered in the search dialog. When you pass these to an SQLite
+delivers the {@code selection} parameter as {@code "word MATCH ?"} and the {@code selectionArgs}
+parameter as the search query. When you pass these to an SQLite
 {@link android.database.sqlite.SQLiteDatabase#query(String,String[],String,String[],String,String,
 String) query()} method, as their respective arguments, they are synthesized together (the
 question mark is replaced with the query
@@ -296,9 +294,9 @@ parameter, because this value is wrapped in quotes and inserted in place of the
 question mark.</p>
 
 <p>Another new attribute in the example above is {@code android:searchSuggestIntentAction}, which
-defines the Intent action sent with each Intent when the user selects a suggestion. It is
+defines the intent action sent with each intent when the user selects a suggestion. It is
 discussed further in the section about <a href="#IntentForSuggestions">Declaring an Intent for
-suggestions</a>.</p>
+Suggestions</a>.</p>
 
 <p class="note"><strong>Tip:</strong> If you don't want to define a selection clause in
 the {@code android:searchSuggestSelection} attribute, but would still like to receive the query
@@ -317,7 +315,7 @@ handle it.</p>
 <h2>Creating a Cursor without a table</h2>
 <p>If your search suggestions are not stored in a table format (such as an SQLite table) using the
 columns required by the
-Search Manager, then you can search your suggestion data for matches and then format them
+system, then you can search your suggestion data for matches and then format them
 into the necessary table on each request. To do so, create a {@link android.database.MatrixCursor}
 using the required column names and then add a row for each suggestion using {@link
 android.database.MatrixCursor#addRow(Object[])}. Return the final product from your Content
@@ -326,18 +324,18 @@ android.content.ContentProvider#query(Uri,String[],String,String[],String) query
 </div>
 </div>
 
-<p>When you return suggestions to the Search Manager with a {@link android.database.Cursor}, the
-Search Manager expects specific columns in each row. So, regardless of whether you
+<p>When you return suggestions to the system with a {@link android.database.Cursor}, the
+system expects specific columns in each row. So, regardless of whether you
 decide to store
 your suggestion data in an SQLite database on the device, a database on a web server, or another
 format on the device or web, you must format the suggestions as rows in a table and
-present them with a {@link android.database.Cursor}. The Search
-Manager understands several columns, but only two are required:</p>
+present them with a {@link android.database.Cursor}. The system understands several columns, but
+only two are required:</p>
 
 <dl>
   <dt>{@link android.provider.BaseColumns#_ID}</dt>
-  <dd>A unique integer row ID for each suggestion. The search dialog requires this in order
-to present suggestions in a ListView.</dd>
+  <dd>A unique integer row ID for each suggestion. The system requires this in order
+to present suggestions in a {@link android.widget.ListView}.</dd>
   <dt>{@link android.app.SearchManager#SUGGEST_COLUMN_TEXT_1}</dt>
   <dd>The string that is presented as a suggestion.</dd>
 </dl>
@@ -359,35 +357,35 @@ This can be null or zero to indicate no icon in this row.</dd>
 all suggestions are provided in an icon-plus-text format with the icon on the right side. This can
 be null or zero to indicate no icon in this row.</dd>
   <dt>{@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_ACTION}</dt>
-  <dd>An Intent action string. If this column exists and contains a value at the given row, the
-action defined here is used when forming the suggestion's Intent. If the element is not
+  <dd>An intent action string. If this column exists and contains a value at the given row, the
+action defined here is used when forming the suggestion's intent. If the element is not
 provided, the action is taken from the {@code android:searchSuggestIntentAction} field in your
 searchable configuration. If your action is the same for all
 suggestions, it is more efficient to specify the action using {@code
 android:searchSuggestIntentAction} and omit this column.</dd>
   <dt>{@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_DATA}</dt>
   <dd>A data URI string. If this column exists and contains a value at the given row, this is the
-data that is used when forming the suggestion's Intent. If the element is not provided, the data is
+data that is used when forming the suggestion's intent. If the element is not provided, the data is
 taken from the {@code android:searchSuggestIntentData} field in your searchable configuration. If
 neither source is provided,
-the Intent's data field is null. If your data is the same for all suggestions, or can be
+the intent's data field is null. If your data is the same for all suggestions, or can be
 described using a constant part and a specific ID, it is more efficient to specify it using {@code
 android:searchSuggestIntentData} and omit this column.
 </dd>
   <dt>{@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_DATA_ID}</dt>
   <dd>A URI path string. If this column exists and contains a value at the given row, then "/" and
-this value is appended to the data field in the Intent. This should only be used if the data field
+this value is appended to the data field in the intent. This should only be used if the data field
 specified
 by the {@code android:searchSuggestIntentData} attribute in the searchable configuration has already
 been set to an appropriate base string.</dd>
   <dt>{@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_EXTRA_DATA}</dt>
   <dd>Arbitrary data. If this column exists and contains a value at a given row, this is the
-<em>extra</em> data used when forming the suggestion's Intent. If not provided, the
-Intent's extra data field is null. This column allows suggestions to provide additional data that is
-included as an extra in the Intent's {@link android.app.SearchManager#EXTRA_DATA_KEY} key.</dd>
+<em>extra</em> data used when forming the suggestion's intent. If not provided, the
+intent's extra data field is null. This column allows suggestions to provide additional data that is
+included as an extra in the intent's {@link android.app.SearchManager#EXTRA_DATA_KEY} key.</dd>
   <dt>{@link android.app.SearchManager#SUGGEST_COLUMN_QUERY}</dt>
   <dd>If this column exists and this element exists at the given row, this is the data that is
-used when forming the suggestion's query, included as an extra in the Intent's {@link
+used when forming the suggestion's query, included as an extra in the intent's {@link
 android.app.SearchManager#QUERY} key. Required if suggestion's action is {@link
 android.content.Intent#ACTION_SEARCH}, optional otherwise.</dd>
   <dt>{@link android.app.SearchManager#SUGGEST_COLUMN_SHORTCUT_ID}</dt>
@@ -410,22 +408,22 @@ while the shortcut of this suggestion is being refreshed in Quick Search Box.</d
 
 
 
-<h2 id="IntentForSuggestions">Declaring an Intent for suggestions</h2>
+<h2 id="IntentForSuggestions">Declaring an Intent for Suggestions</h2>
 
-<p>When the user selects a suggestion from the list that appears below the search dialog, the Search
-Manager sends a custom {@link android.content.Intent} to your searchable Activity. You must define
-the action and data for the Intent.</p>
+<p>When the user selects a suggestion from the list that appears below the search dialog or widget,
+the system sends a custom {@link android.content.Intent} to your searchable activity. You
+must define the action and data for the intent.</p>
 
 
-<h3 id="IntentAction">Declaring the Intent action</h3>
+<h3 id="IntentAction">Declaring the intent action</h3>
 
-<p>The most common Intent action for a custom suggestion is {@link
+<p>The most common intent action for a custom suggestion is {@link
 android.content.Intent#ACTION_VIEW}, which is appropriate when
 you want to open something, like the definition for a word, a person's contact information, or a web
-page. However, the Intent action can be any other action and can even be different for each
+page. However, the intent action can be any other action and can even be different for each
 suggestion.</p>
 
-<p>Depending on whether you want all suggestions to use the same Intent action, you
+<p>Depending on whether you want all suggestions to use the same intent action, you
 can define the action in two ways:</p>
 
 <ol type="a">
@@ -457,34 +455,34 @@ android:searchSuggestIntentAction} attribute with an action to be used with all
 default, then override this action for some suggestions by declaring a different action in the
 {@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_ACTION} column. If you do not include
 a value in the {@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_ACTION} column, then the
-Intent provided in the {@code android:searchSuggestIntentAction} attribute is used.</p>
+intent provided in the {@code android:searchSuggestIntentAction} attribute is used.</p>
 
 <p class="note"><strong>Note</strong>: If you do not include the
 {@code android:searchSuggestIntentAction} attribute in your searchable configuration, then you
 <em>must</em> include a value in the {@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_ACTION}
-column for every suggestion, or the Intent will fail.</p>
+column for every suggestion, or the intent will fail.</p>
 
 
 
-<h3 id="IntentData">Declaring Intent data</h3>
+<h3 id="IntentData">Declaring intent data</h3>
 
-<p>When the user selects a suggestion, your searchable Activity receives the Intent with the
-action you've defined (as discussed in the previous section), but the Intent must also carry
-data in order for your Activity to identify which suggestion was selected. Specifically,
+<p>When the user selects a suggestion, your searchable activity receives the intent with the
+action you've defined (as discussed in the previous section), but the intent must also carry
+data in order for your activity to identify which suggestion was selected. Specifically,
 the data should be something unique for each suggestion, such as the row ID for the suggestion in
-your SQLite table. When the Intent is received,
+your SQLite table. When the intent is received,
 you can retrieve the attached data with {@link android.content.Intent#getData()} or {@link
 android.content.Intent#getDataString()}.</p>
 
-<p>You can define the data included with the Intent in two ways:</p>
+<p>You can define the data included with the intent in two ways:</p>
 
 <ol type="a">
   <li>Define the data for each suggestion inside the {@link
 android.app.SearchManager#SUGGEST_COLUMN_INTENT_DATA} column of your suggestions table.
 
-<p>Provide all necessary data information for each Intent in the suggestions table by including the
+<p>Provide all necessary data information for each intent in the suggestions table by including the
 {@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_DATA} column and then populating it with
-unique data for each row. The data from this column is attached to the Intent exactly as you
+unique data for each row. The data from this column is attached to the intent exactly as you
 define it in this column. You can then retrieve it with with {@link
 android.content.Intent#getData()} or {@link android.content.Intent#getDataString()}.</p>
 
@@ -498,7 +496,7 @@ projection map of column names to aliases.</p>
   </li>
 
   <li>Fragment a data URI into two pieces: the portion common to all suggestions and the portion
-unique to each suggestion. Place these parts into the {@code android:searchSuggestIntentData}
+unique to each suggestion. Place these parts into the {@code android:searchSuggestintentData}
 attribute of the searchable configuration and the {@link
 android.app.SearchManager#SUGGEST_COLUMN_INTENT_DATA_ID} column of your
 suggestions table, respectively.
@@ -512,14 +510,14 @@ android:searchSuggestIntentData} attribute of your searchable configuration. For
     android:label="@string/app_label"
     android:hint="@string/search_hint"
     android:searchSuggestAuthority="com.example.MyCustomSuggestionProvider"
-    android:searchSuggestIntentAction="android.Intent.action.VIEW"
+    android:searchSuggestIntentAction="android.intent.action.VIEW"
     <b>android:searchSuggestIntentData="content://com.example/datatable"</b> >
 &lt;/searchable>
 </pre>
 
 <p>Then include the final path for each suggestion (the unique part) in the {@link
 android.app.SearchManager#SUGGEST_COLUMN_INTENT_DATA_ID}
-column of your suggestions table. When the user selects a suggestion, the Search Manager takes
+column of your suggestions table. When the user selects a suggestion, the system takes
 the string from {@code android:searchSuggestIntentData}, appends a slash ("/") and then adds the
 respective value from the {@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_DATA_ID} column to
 form a complete content URI. You can then retrieve the {@link android.net.Uri} with with {@link
@@ -530,20 +528,20 @@ android.content.Intent#getData()}.</p>
 
 <h4>Add more data</h4>
 
-<p>If you need to express even more information with your Intent, you can add another table column,
+<p>If you need to express even more information with your intent, you can add another table column,
 {@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_EXTRA_DATA}, which can store additional
 information about the suggestion. The data saved in this column is placed in {@link
-android.app.SearchManager#EXTRA_DATA_KEY} of the Intent's extra Bundle.</p>
+android.app.SearchManager#EXTRA_DATA_KEY} of the intent's extra Bundle.</p>
 
 
 
 <h2 id="HandlingIntent">Handling the Intent</h2>
 
-<p>Now that your search dialog provides custom search suggestions with custom Intents, you
-need your searchable Activity to handle these Intents when the user selects a
+<p>Now that you provide custom search suggestions with custom intents, you
+need your searchable activity to handle these intents when the user selects a
 suggestion. This is in addition to handling the {@link
-android.content.Intent#ACTION_SEARCH} Intent, which your searchable Activity already does.
-Here's an example of how you can handle the Intents during your Activity {@link
+android.content.Intent#ACTION_SEARCH} intent, which your searchable activity already does.
+Here's an example of how you can handle the intents during your activity {@link
 android.app.Activity#onCreate(Bundle) onCreate()} callback:</p>
 
 <pre>
@@ -559,25 +557,25 @@ if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
 }
 </pre>
 
-<p>In this example, the Intent action is {@link
+<p>In this example, the intent action is {@link
 android.content.Intent#ACTION_VIEW} and the data carries a complete URI pointing to the suggested
 item, as synthesized by the {@code android:searchSuggestIntentData} string and {@link
 android.app.SearchManager#SUGGEST_COLUMN_INTENT_DATA_ID} column. The URI is then passed to the local
 {@code showResult()} method that queries the content provider for the item specified by the URI.</p>
 
-<p class="note"><strong>Note:</strong> You do <em>not</em> need to add an Intent filter to your
-Android manifest file for the Intent action you defined with the {@code
+<p class="note"><strong>Note:</strong> You do <em>not</em> need to add an intent filter to your
+Android manifest file for the intent action you defined with the {@code
 android:searchSuggestIntentAction} attribute or {@link
-android.app.SearchManager#SUGGEST_COLUMN_INTENT_ACTION} column. The Search Manager opens your
-searchable Activity by name to deliver the suggestion's Intent, so the Activity does not need to
+android.app.SearchManager#SUGGEST_COLUMN_INTENT_ACTION} column. The system opens your
+searchable activity by name to deliver the suggestion's intent, so the activity does not need to
 declare the accepted action.</p>
 
 
 <h2 id="RewritingQueryText">Rewriting the query text</h2>
 
-<p>If the user navigates through the suggestions list using the directional controls (trackball or
-d-pad), the text in the search dialog won't change, by default. However, you can temporarily rewrite
-the user's query text as it appears in the text box with
+<p>If the user navigates through the suggestions list using the directional controls (such
+as with a trackball or d-pad), the query text does not update, by default. However, you
+can temporarily rewrite the user's query text as it appears in the text box with
 a query that matches the suggestion currently in focus. This enables the user to see what query is
 being suggested (if appropriate) and then select the search box and edit the query before
 dispatching it as a search.</p>
@@ -654,7 +652,7 @@ android:searchSettingsDescription} attribute to your searchable configuration. F
     android:label="@string/app_label"
     android:hint="@string/search_hint"
     android:searchSuggestAuthority="com.example.MyCustomSuggestionProvider"
-    android:searchSuggestIntentAction="android.Intent.action.VIEW"
+    android:searchSuggestIntentAction="android.intent.action.VIEW"
     android:includeInGlobalSearch="true"
     <b>android:searchSettingsDescription="@string/search_description"</b> >
 &lt;/searchable>
@@ -676,7 +674,7 @@ them how to enable search suggestions for Quick Search Box.</p>
 <h3 id="ManagingShortcuts">Managing Quick Search Box suggestion shortcuts</h3>
 
 <p>Suggestions that the user selects from Quick Search Box can be automatically made into shortcuts.
-These are suggestions that the Search Manager has copied from your content provider  so it can
+These are suggestions that the system has copied from your content provider  so it can
 quickly access the suggestion without the need to re-query your content provider. </p>
 
 <p>By default, this is enabled for all suggestions retrieved by Quick Search Box, but if your
index cb063a1..2c9a461 100644 (file)
@@ -28,13 +28,15 @@ Configuration</a></li>
 </div>
 </div>
 
-<p>When using the Android search dialog, you can provide search suggestions based on recent search
+<p>When using the Android search dialog or search widget, you can provide search suggestions based
+on recent search
 queries. For example, if a user previously searched for "puppies," then that query appears as a
 suggestion once he or she begins typing the same query. Figure 1 shows an example of a search dialog
 with recent query suggestions.</p>
 
-<p>Before you begin, you need to implement the search dialog for basic searches in your application.
-If you haven't, see <a href="search-dialog.html">Using the Android Search Dialog</a>.</p>
+<p>Before you begin, you need to implement the search dialog or a search widget for basic searches
+in your application.
+If you haven't, see <a href="search-dialog.html">Creating a Search Interface</a>.</p>
 
 
 
@@ -47,16 +49,16 @@ suggestions.</p>
 </div>
 
 <p>Recent query suggestions are simply saved searches. When the user selects one of
-the suggestions, your searchable Activity receives a {@link
-android.content.Intent#ACTION_SEARCH} Intent with the suggestion as the search query, which your
-searchable Activity already handles (as described in <a href="search-dialog.html">Using the Android
-Search Dialog</a>).</p>
+the suggestions, your searchable activity receives a {@link
+android.content.Intent#ACTION_SEARCH} intent with the suggestion as the search query, which your
+searchable activity already handles (as described in <a href="search-dialog.html">Creating a Search
+Interface</a>).</p>
 
 <p>To provide recent queries suggestions, you need to:</p>
 
 <ul>
-  <li>Implement a searchable Activity, <a
-href="{@docRoot}guide/topics/search/search-dialog.html">using the Android Search Dialog</a>.</li>
+  <li>Implement a searchable activity, as described in <a
+href="{@docRoot}guide/topics/search/search-dialog.html">Creating a Search Interface</a>.</li>
   <li>Create a content provider that extends {@link
 android.content.SearchRecentSuggestionsProvider} and declare it in your application manifest.</li>
   <li>Modify the searchable configuration with information about the content provider that
@@ -64,20 +66,19 @@ provides search suggestions.</li>
   <li>Save queries to your content provider each time a search is executed.</li>
 </ul>
 
-<p>Just as the Search Manager displays the search dialog, it also displays the
-search suggestions. All you need to do is provide a source from which the suggestions can be
-retrieved.</p>
+<p>Just as the Android system displays the search dialog, it also displays the
+search suggestions below the dialog or search widget. All you need to do is provide a source from
+which the system can retrieve suggestions.</p>
 
-<p>When the Search Manager identifies that your Activity is searchable and provides search
-suggestions, the following procedure takes place as soon as the user types into the search
-dialog:</p>
+<p>When the system identifies that your activity is searchable and provides search
+suggestions, the following procedure takes place as soon as the user begins typing a query:</p>
 
 <ol>
-  <li>Search Manager takes the search query text (whatever has been typed so far) and performs a
+  <li>The system takes the search query text (whatever has been typed so far) and performs a
 query to the content provider that contains your suggestions.</li>
   <li>Your content provider returns a {@link android.database.Cursor} that points to all
 suggestions that match the search query text.</li>
-  <li>Search Manager displays the list of suggestions provided by the Cursor.</li>
+  <li>The system displays the list of suggestions provided by the Cursor.</li>
 </ol>
 
 <p>Once the recent query suggestions are displayed, the following might happen:</p>
@@ -86,10 +87,10 @@ suggestions that match the search query text.</li>
   <li>If the user types another key, or changes the query in any way, the aforementioned steps are
 repeated and the suggestion list is updated.</li>
   <li>If the user executes the search, the suggestions are ignored and the search is delivered
-to your searchable Activity using the normal {@link android.content.Intent#ACTION_SEARCH}
-Intent.</li>
+to your searchable activity using the normal {@link android.content.Intent#ACTION_SEARCH}
+intent.</li>
   <li>If the user selects a suggestion, an
-{@link android.content.Intent#ACTION_SEARCH} Intent is delivered to your searchable Activity using
+{@link android.content.Intent#ACTION_SEARCH} intent is delivered to your searchable activity using
 the suggested text as the query.</li>
 </ul>
 
@@ -151,7 +152,7 @@ searchable configuration). For example:</p>
 
 <h2 id="RecentQuerySearchableConfiguration">Modifying the Searchable Configuration</h2>
 
-<p>To configure your search dialog to use your suggestions provider, you need to add
+<p>To configure the system to use your suggestions provider, you need to add
 the {@code android:searchSuggestAuthority} and {@code android:searchSuggestSelection} attributes to
 the {@code &lt;searchable&gt;} element in your searchable configuration file. For example:</p>
 
@@ -179,12 +180,12 @@ automatically replaced by the query text entered by the user).</p>
 <h2 id="SavingQueries">Saving Queries</h2>
 
 <p>To populate your collection of recent queries, add each query
-received by your searchable Activity to your {@link
+received by your searchable activity to your {@link
 android.content.SearchRecentSuggestionsProvider}. To do this, create an instance of {@link
 android.provider.SearchRecentSuggestions} and call {@link
 android.provider.SearchRecentSuggestions#saveRecentQuery(String,String) saveRecentQuery()} each time
-your searchable Activity receives a query. For example, here's how you can save the query during
-your Activity's {@link android.app.Activity#onCreate(Bundle) onCreate()} method:</p>
+your searchable activity receives a query. For example, here's how you can save the query during
+your activity's {@link android.app.Activity#onCreate(Bundle) onCreate()} method:</p>
 
 <pre>
 &#64;Override
@@ -192,10 +193,10 @@ public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.main);
 
-    Intent Intent  = getIntent();
+    Intent intent  = getIntent();
 
-    if (Intent.ACTION_SEARCH.equals(Intent .getAction())) {
-        String query = Intent .getStringExtra(SearchManager.QUERY);
+    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
+        String query = intent.getStringExtra(SearchManager.QUERY);
         SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this,
                 MySuggestionProvider.AUTHORITY, MySuggestionProvider.MODE);
         suggestions.saveRecentQuery(query, null);
@@ -212,7 +213,7 @@ the search query string as the first parameter and, optionally, a second string
 second line of the suggestion (or null). The second parameter is only used if you've enabled
 two-line mode for the search suggestions with {@link
 android.content.SearchRecentSuggestionsProvider#DATABASE_MODE_2LINES}. If you have enabled
-two-line mode, then the query text is also matched against this second line when the Search Manager
+two-line mode, then the query text is also matched against this second line when the system
 looks for matching suggestions.</p>
 
 
index f563715..7ac5ff1 100644 (file)
@@ -5,7 +5,7 @@ page.title=Search
 <div id="qv">
 <h2>Topics</h2>
 <ol>
-<li><a href="search-dialog.html">Using the Android Search Dialog</a></li>
+<li><a href="search-dialog.html">Creating a Search Interface</a></li>
 <li><a href="adding-recent-query-suggestions.html">Adding Recent Query Suggestions</a></li>
 <li><a href="adding-custom-suggestions.html">Adding Custom Suggestions</a></li>
 </ol>
@@ -24,9 +24,8 @@ Dictionary</a></li>
 
 <p>Search is a core user feature on Android. Users should be able
 to search any data that is available to them, whether the content is located on the device or
-the Internet. The search experience should be seamless and consistent across the entire
-system, which is why Android provides a search framework to help you provide users with
-a familiar search dialog and a great search experience.</p>
+the Internet. To help create a consistent search experience for users, Android provides a
+search framework that helps you implement search for your application.</p>
 
 <div class="figure" style="width:250px">
 <img src="{@docRoot}images/search/search-suggest-custom.png" alt="" height="417" />
@@ -34,16 +33,14 @@ a familiar search dialog and a great search experience.</p>
 search suggestions.</p>
 </div>
 
-<p>Android's search framework provides a user interface in which users can perform a search and
-an interaction layer that communicates with your application, so you don't have to build
-your own search Activity. Instead, a search dialog appears at the top of the screen at the user's
-command without interrupting the current Activity.</p>
+<p>The search framework offers two modes of search input: a search dialog at the top of the
+screen or a search widget ({@link android.widget.SearchView}) that you can embed in your activity
+layout. In either case, the Android system will assist your search implementation by
+delivering search queries to a specific activity that performs searchs. You can also enable either
+the search dialog or widget to provide search suggestions as the user types. Figure 1 shows an
+example of the search dialog with optional search suggestions.</p>
 
-<p>The search framework manages the life of the search dialog. When users execute a search, the
-search framework passes the query text to your application so your application can perform a
-search. Figure 1 shows an example of the search dialog with optional search suggestions.</p>
-
-<p>Once your application is set up to use the search dialog, you can:</p>
+<p>Once you've set up either the search dialog or the search widget, you can:</p>
 
 <ul>
 <li>Enable voice search</li>
@@ -57,19 +54,19 @@ search your data. To perform a search, you need to use APIs appropriate for your
 if your data is stored in an SQLite database, you should use the {@link android.database.sqlite}
 APIs to perform searches.</p>
 
-<p>The following documents show you how to use the search dialog in your application:</p>
+<p>The following documents show you how to use Android's framework to implement search:</p>
 
 <dl>
-  <dt><strong><a href="search-dialog.html">Using the Android Search Dialog</a></strong></dt>
-  <dd>How to set up your application to use the search dialog. </dd>
+  <dt><strong><a href="search-dialog.html">Creating a Search Interface</a></strong></dt>
+  <dd>How to set up your application to use the search dialog or search widget. </dd>
   <dt><strong><a href="adding-recent-query-suggestions.html">Adding Recent Query
 Suggestions</a></strong></dt>
-  <dd>How to show suggestions based on queries previously used in the search dialog.</dd>
+  <dd>How to provide suggestions based on queries previously used.</dd>
   <dt><strong><a href="adding-custom-suggestions.html">Adding Custom Suggestions</a></strong></dt>
-  <dd>How to show suggestions based on custom data from your application and offer your suggestions
+  <dd>How to provide suggestions based on custom data from your application and also offer them
 in the system-wide Quick Search Box.</dd>
   <dt><strong><a href="searchable-config.html">Searchable Configuration</a></strong></dt>
-  <dd>A reference for the searchable configuration file (though the other
+  <dd>A reference document for the searchable configuration file (though the other
 documents also discuss the configuration file in terms of specific behaviors).</dd>
 </dl>
 
@@ -92,17 +89,17 @@ you don't need to send the user ID as well; send only the zip code to the server
 send the personal information, you should not log it. If you must log it, protect that data
 very carefully and erase it as soon as possible.</p>
 </li>
-<li><strong>Provide the user with a way to clear their search history.</strong>
+<li><strong>Provide users with a way to clear their search history.</strong>
 <p>The search framework helps your application provide context-specific suggestions while the user
 types. Sometimes these
 suggestions are based on previous searches or other actions taken by the user in an earlier
 session. A user might not wish for previous searches to be revealed to other device users, for
-instance, if they share their phone with a friend. If your application provides suggestions that can
-reveal previous activities, you should implement the ability for the user to clear the search
-history. If you are using {@link android.provider.SearchRecentSuggestions}, you can simply call the
-{@link android.provider.SearchRecentSuggestions#clearHistory()} method. If you are implementing
-custom suggestions, you'll need to provide a similar "clear history" method in your provider that
-the user can execute.</p>
+instance, if the user shares the device with a friend. If your application provides suggestions that
+can reveal previous search activities, you should implement the ability for the user to clear the
+search history. If you are using {@link android.provider.SearchRecentSuggestions}, you can simply
+call the {@link android.provider.SearchRecentSuggestions#clearHistory()} method. If you are
+implementing custom suggestions, you'll need to provide a similar "clear history" method in your
+content provider that the user can execute.</p>
 </li>
 </ul>
 
index 6699fe1..af6c8f2 100644 (file)
@@ -1,38 +1,61 @@
-page.title=Using the Android Search Dialog
+page.title=Creating a Search Interface
 parent.title=Search
 parent.link=index.html
 @jd:body
 
 <div id="qv-wrapper">
 <div id="qv">
+
+  <h2>Quickview</h2>
+  <ul>
+    <li>The Android system sends search queries from the search dialog or widget to an activity you
+specify to perform searches and present results</li>
+    <li>You can put the search widget in the Action Bar, as an "action view," for quick
+access</li>
+  </ul>
+
+
 <h2>In this document</h2>
 <ol>
 <li><a href="#TheBasics">The Basics</a></li>
 <li><a href="#SearchableConfiguration">Creating a Searchable Configuration</a></li>
 <li><a href="#SearchableActivity">Creating a Searchable Activity</a>
   <ol>
-    <li><a href="#DeclaringSearchableActivity">Declaring a searchable Activity</a></li>
+    <li><a href="#DeclaringSearchableActivity">Declaring a searchable activity</a></li>
+    <li><a href="#EnableSearch">Enabling the search dialog and search widget</a></li>
     <li><a href="#PerformingSearch">Performing a search</a></li>
   </ol>
 </li>
-<li><a href="#InvokingTheSearchDialog">Invoking the Search Dialog</a>
+<li><a href="#UsingTheSearchDialog">Using the Search Dialog</a>
+  <ol>
+    <li><a href="#LifeCycle">The impact of the search dialog on your activity lifecycle</a></li>
+    <li><a href="#SearchContextData">Passing search context data</a></li>
+  </ol>
+</li>
+<li><a href="#UsingSearchWidget">Using the Search Widget</a>
   <ol>
-    <li><a href="#LifeCycle">The impact of the search dialog on your Activity life-cycle</a></li>
+    <li><a href="#ConfiguringWidget">Configuring the search widget</a></li>
+    <li><a href="#WidgetFeatures">Other search widget features</a></li>
   </ol>
 </li>
-<li><a href="#SearchContextData">Passing Search Context Data</a></li>
 <li><a href="#VoiceSearch">Adding Voice Search</a></li>
+<li><a href="#SearchSuggestions">Adding Search Suggestions</a></li>
 </ol>
 
 <h2>Key classes</h2>
 <ol>
 <li>{@link android.app.SearchManager}</li>
+<li>{@link android.widget.SearchView}</li>
 </ol>
 
 <h2>Related samples</h2>
 <ol>
 <li><a href="{@docRoot}resources/samples/SearchableDictionary/index.html">Searchable
 Dictionary</a></li>
+<li><a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/SearchViewActionBar.html">SearchView
+    in the Action Bar</a></li>
+<li><a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/SearchViewFilterMode.html">SearchView
+    filter mode</a></li>
 </ol>
 
 <h2>Downloads</h2>
@@ -50,16 +73,24 @@ Dictionary</a></li>
 </div>
 </div>
 
-<p>When you want to implement search in your application, the last thing you should have to worry
-about is where to put the search box. When you implement search with the Android search framework,
-you don't have to. When the user invokes search, a search dialog appears at the top of the screen
-with your application icon to the left of the search box. When the user executes the search, your
-application receives the query so it can search your application's data. An example of the search
-dialog is shown in figure 1.</p>
+<p>When you're ready to add search functionality to your application, Android helps you implement
+the user interface with either a search dialog that appears at the top of the activity window or a
+search widget that you can insert in your layout. Both the search dialog and the widget can deliver
+the user's search query to a specific activity in your application. This way, the user can initiate
+a search from any activity where the search dialog or widget is available, and the system starts the
+appropriate activity to perform the search and present results.</p>
+
+<p>Other features available for the search dialog and widget include:</p>
 
-<p>This guide shows you how to set up your application to provide search in the search
-dialog. When you use the search dialog, you provide a standardized search
-experience and can add features such as voice search and search suggestions.</p>
+<ul>
+  <li>Voice search</li>
+  <li>Search suggestions based on recent queries</li>
+  <li>Search suggestions that match actual results in your application data</li>
+</ul>
+
+<p>This guide shows you how to set up your application to provide a search interface
+that's assisted by the Android system to deliver search queries, using either the
+search dialog or the search widget.</p>
 
 
 <h2 id="TheBasics">The Basics</h2>
@@ -69,40 +100,78 @@ experience and can add features such as voice search and search suggestions.</p>
 <p class="img-caption"><strong>Figure 1.</strong> Screenshot of an application's search dialog.</p>
 </div>
 
-<p>The Android search framework manages the search dialog for your application. You never need
-to draw it or worry about where it is, and your Activity is not interrupted when the search dialog
-appears. The Search Manager ({@link android.app.SearchManager}) is the component that does this work
-for you. It manages the life of the search dialog and sends your application the user's search
-query.</p>
-
-<p>When the user executes a search, the Search Manager creates an {@link android.content.Intent} to
-pass the search query to the Activity that you've declared to handle searches. Basically, all you
-need is an Activity that receives the search Intent, performs the search, and presents the results.
-Specifically, you need the following:</p>
-
-<dl>
-  <dt>A searchable configuration</dt>
-  <dd>An XML file that configures the search dialog and includes settings for features such as voice
-search, search suggestion, and the hint text.</dd>
-  <dt>A searchable Activity</dt>
-  <dd>The {@link android.app.Activity} that receives the search query, then searches your data and
-displays the search results.</dd>
-  <dt>A mechanism by which the user can invoke search</dt>
-  <dd>The device search key invokes the search dialog, by default. However, a dedicated search key
-is not guaranteed on all devices, so provide another means by which the user can invoke a search,
-such as a search button in the Options Menu or elsewhere in the Activity UI.</dd>
-</dl>
-
+<p>Before you begin, you should decide whether you'll implement your search interface using the
+search dialog or the search widget. Both provide the same search features, but in slightly different
+ways:</p>
+
+<ul>
+  <li>The <strong>search dialog</strong> is a UI component that's controlled by the Android system.
+When activated by the user, the search dialog appears at the top of the activity, as shown in figure
+1.
+    <p>The Android system controls all events in the search dialog. When the user
+submits a query, the system delivers the query to the activity that you specify to
+handle searches. The dialog can also provide search suggestions while the user types.</p></li>
+
+  <li>The <strong>search widget</strong> is an instance of {@link android.widget.SearchView} that
+you can place anywhere in your layout. By default, the search widget behaves like a standard {@link
+android.widget.EditText} widget and doesn't do anything, but you can configure it so that the
+Android system handles all input events, delivers queries to the appropriate activity, and provides
+search suggestions (just like the search dialog). However, the search widget is available only in
+Android 3.0 (API Level 11) and higher.
+
+<p class="note"><strong>Note:</strong> If you want, you can handle all user input into the
+search widget yourself, using various callback methods and listeners. This document, however,
+focuses on how to integrate the search widget with the system for an assisted search
+implementation. If you want to handle all user input yourself, read the reference documentation for
+{@link android.widget.SearchView} and its nested interfaces. </p></li>
+</ul>
+
+<p>When the user executes a search from the search dialog or a search widget, the system creates an
+{@link android.content.Intent} and stores the user query in it. The system then starts the activity
+that you've declared to handle searches (the "searchable activity") and delivers it the intent. To
+set up your application for this kind of assisted search, you need the following:</p>
+
+<ul>
+  <li>A searchable configuration
+  <p>An XML file that configures some settings for the search dialog or widget. It includes settings
+for features such as voice search, search suggestion, and hint text for the search box.</p></li>
+  <li>A searchable activity
+  <p>The {@link android.app.Activity} that receives the search query, searches your
+data, and displays the search results.</p></li>
+  <li>A search interface, provided by either:
+    <ul>
+      <li>The search dialog
+        <p>By default, the search dialog is hidden, but appears at the top of the screen when the 
+user presses the device SEARCH button (when available) or another button in your user interface.</p>
+      </li>
+      <li>Or, a {@link android.widget.SearchView} widget
+        <p>Using the search widget allows you to put the search box anywhere in your activity.
+Instead of putting it in your activity layout, however, it's usually more convenient for users as an
+<a href="{@docRoot}guide/topics/ui/actionbar.html#ActionView">action view in the Action Bar</a>.</p>
+      </li>
+    </ul>
+  </li>
+</ul>
+
+<p>The rest of this document shows you how to create the searchable configuration, searchable
+activity, and implement a search interface with either the search dialog or search widget.</p>
 
 
 <h2 id="SearchableConfiguration">Creating a Searchable Configuration</h2>
 
-<p>The searchable configuration is an XML file that defines several settings for the search
-dialog in your application. This file is traditionally named {@code searchable.xml} and must be
-saved in the {@code res/xml/} project directory.</p>
+<p>The first thing you need is an XML file called the searchable configuration. It configures
+certain UI aspects of the search dialog or widget and defines how features such as suggestions and
+voice search behave. This file is traditionally named {@code searchable.xml} and must be saved in
+the {@code res/xml/} project directory.</p>
+
+<p class="note"><strong>Note:</strong> The system uses this file to instantiate a {@link
+android.app.SearchableInfo} object, but you cannot create this object yourself at
+runtime&mdash;you must declare the searchable configuration in XML.</p>
 
-<p>The file must consist of the {@code &lt;searchable&gt;} element as the root node and specify one
-or more attributes that configure your search dialog. For example:</p>
+<p>The searchable configuration file must include the <a
+href="{@docRoot}guide/topics/search/searchable-config.html#searchable-element">{@code
+&lt;searchable&gt;}</a> element as the root node and specify one
+or more attributes. For example:</p>
 
 <pre>
 &lt;?xml version="1.0" encoding="utf-8"?>
@@ -112,51 +181,61 @@ or more attributes that configure your search dialog. For example:</p>
 &lt;/searchable>
 </pre>
 
-<p>The {@code android:label} attribute is the only required attribute and points to a string
-resource, which should be the same as the application name. This label isn't actually visible to the
-user until you enable suggestions for Quick Search Box, at which point, this label is visible in the
-list of Searchable items in the system Settings.</p>
+<p>The {@code android:label} attribute is the only required attribute. It points to a string
+resource, which should be the application name. This label isn't actually visible to the
+user until you enable search suggestions for Quick Search Box. At that point, this label is visible
+in the list of Searchable items in the system Settings.</p>
 
 <p>Though it's not required, we recommend that you always include the {@code android:hint}
-attribute, which provides a hint string in the search dialog's text box before the user
-enters their query. The hint is important because it provides important clues to users about what
+attribute, which provides a hint string in the search box before users
+enters a query. The hint is important because it provides important clues to users about what
 they can search.</p>
 
 <p class="note"><strong>Tip:</strong> For consistency among other
 Android applications, you should format the string for {@code android:hint} as "Search
-<em>&lt;content-or-product&gt;</em>". For example, "Search songs and artists" or "Search
+&lt;content-or-product&gt;". For example, "Search songs and artists" or "Search
 YouTube".</p>
 
-<p>The {@code &lt;searchable&gt;} element accepts several other attributes. Most attributes apply
-only when configuring features such as search suggestions and voice search.</p>
-
-<p>For more details about the searchable configuration file, see the <a
-href="{@docRoot}guide/topics/search/searchable-config.html">Searchable Configuration</a>
-reference.</p>
+<p>The <a
+href="{@docRoot}guide/topics/search/searchable-config.html#searchable-element">{@code
+&lt;searchable&gt;}</a> element accepts several other attributes. However, you don't need
+most attributes until you add features such as <a href="#SearchSuggestions">search suggestions</a>
+and <a href="#VoiceSearch">voice search</a>. For detailed information about the searchable
+configuration file, see the <a
+href="{@docRoot}guide/topics/search/searchable-config.html">Searchable Configuration</a> reference
+document.</p>
 
 
 
 <h2 id="SearchableActivity">Creating a Searchable Activity</h2>
 
-<p>When the user executes a search from the search dialog, the Search Manager takes the query
-and sends it to your searchable {@link android.app.Activity} in the {@link
-android.content.Intent#ACTION_SEARCH} {@link android.content.Intent}. Your searchable Activity
-then searches your data using the query and presents the results to the user.</p>
+<p>A searchable activity is the {@link android.app.Activity} in your application that performs
+searches based on a query string and presents the search results.</p>
+
+<p>When the user executes a search in the search dialog or widget, the system starts your
+searchable activity and delivers it the search query in an {@link
+android.content.Intent} with the  {@link android.content.Intent#ACTION_SEARCH} action. Your
+searchable activity retrieves the query from the intent's {@link android.app.SearchManager#QUERY
+QUERY} extra, then searches your data and presents the results.</p>
 
-<p>In order for the Search Manager to know where to deliver the search query, you must declare your
-searchable Activity in the Android manifest file.</p>
+<p>Because you may include the search dialog or widget in any other activity in your application,
+the system must know which activity is your searchable activity, so it can properly deliver the
+search query. So, you must first declare your searchable activity in the Android manifest file.</p>
 
 
-<h3 id="DeclaringSearchableActivity">Declaring a searchable Activity</h3>
+<h3 id="DeclaringSearchableActivity">Declaring a searchable activity</h3>
 
-<p>If you don't have one already, create an {@link android.app.Activity} that performs
-searches and present search results. To set up this Activity as your searchable Activity:</p>
+<p>If you don't have one already, create an {@link android.app.Activity} that will perform
+searches and present results. You don't need to implement the search functionality yet&mdash;just
+create an activity that you can declare in the manifest. Inside the manifest's <a
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a>
+element:</p>
 <ol>
-  <li>Declare the Activity to accept the {@link android.content.Intent#ACTION_SEARCH} {@link
-android.content.Intent}, in an <a
-href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code &lt;intent-filter&gt;}</a>
+  <li>Declare the activity to accept the {@link android.content.Intent#ACTION_SEARCH} intent, in an
+<a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code
+&lt;intent-filter&gt;}</a>
 element.</li>
-  <li>Apply the searchable configuration, in a <a
+  <li>Specify the searchable configuration to use, in a <a
 href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data&gt;}</a>
 element.</li>
 </ol>
@@ -165,7 +244,7 @@ element.</li>
 
 <pre>
 &lt;application ... >
-    &lt;activity android:name=".MySearchableActivity" >
+    &lt;activity android:name=".SearchableActivity" >
         &lt;intent-filter>
             &lt;action android:name="android.intent.action.SEARCH" />
         &lt;/intent-filter>
@@ -181,71 +260,22 @@ value of {@code "android.app.searchable"} and the {@code android:resource} attri
 reference to the searchable configuration file (in this example, it
 refers to the {@code res/xml/searchable.xml} file).</p>
 
-<p class="note"><strong>Note:</strong> The {@code &lt;intent-filter&gt;} does not need a <a
+<p class="note"><strong>Note:</strong> The <a
+href="{@docRoot}guide/topics/manifest/intent-filter-element.html">{@code
+&lt;intent-filter&gt;}</a> does not need a <a
 href="{@docRoot}guide/topics/manifest/category-element.html">{@code &lt;category&gt;}</a> with the
-{@code DEFAULT} value, because the Search Manager delivers the {@link
-android.content.Intent#ACTION_SEARCH} Intent explicitly to your searchable Activity by name.</p>
-
-<p>The search dialog is not, by default, available from every Activity of your
-application. Rather, the search dialog is presented to users only when they
-invoke search from a searchable context of your application. A searchable context is any Activity
-for which you have
-declared searchable meta-data in the manifest file. For example, the searchable Activity itself
-(declared in the manifest snippet above) is
-a searchable context because it includes meta-data that defines the
-searchable configuration. Any other Activity in your application is not a searchable context, by
-default, and thus, does not reveal the search dialog. However, you probably do want the search
-dialog available from your other activities (and to launch the searchable Activity when the user
-executes a search). You can do exactly that.</p>
-
-<p>If you want all of your activities to provide the search dialog, add another {@code
-&lt;meta-data&gt;} element inside the {@code
-&lt;application&gt;} element. Use this element to declare the existing searchable Activity as the
-default searchable Activity. For example:</p>
-
-<pre>
-&lt;application ... >
-    &lt;activity android:name=".MySearchableActivity" >
-        &lt;intent-filter>
-            &lt;action android:name="android.intent.action.SEARCH" />
-        &lt;/intent-filter>
-        &lt;meta-data android:name="android.app.searchable"
-                   android:resource="@xml/searchable"/>
-    &lt;/activity>
-    &lt;activity android:name=".AnotherActivity" ... >
-    &lt;/activity>
-    &lt;!-- declare the default searchable Activity for the whole app --&gt;
-    <b>&lt;meta-data android:name="android.app.default_searchable"
-               android:value=".MySearchableActivity" /&gt;</b>
-    ...
-&lt;/application>
-</pre>
+{@code DEFAULT} value (which you usually see in <a
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a> elements),
+because the system delivers the {@link android.content.Intent#ACTION_SEARCH} intent explicitly to
+your searchable activity, using its component name.</p>
 
-<p>The {@code &lt;meta-data&gt;} element with the {@code android:name} attribute value of
-{@code "android.app.default_searchable"} specifies a default searchable Activity for the context in
-which it is placed (which, in this case, is the entire application). The searchable Activity to
-use is specified with the {@code android:value} attribute. All other activities in the
-application, such as {@code AnotherActivity}, are now considered a searchable context and can invoke
-the search dialog. When a search is executed, {@code MySearchableActivity} is launched to handle
-the search query.</p>
-
-<p>You can also control which activities provide search at a more granular level.
-To specify only an individual Activity as a searchable context, place the {@code
-&lt;meta-data&gt;} with the {@code
-"android.app.default_searchable"} name inside the respective {@code &lt;activity&gt;}
-element (rather than inside the {@code &lt;application&gt;} element). While uncommon, you
-can also create more than one searchable Activity and provide each one in different contexts of your
-application, either by declaring a different searchable Activity in each {@code &lt;activity&gt;}
-element, or by declaring a default searchable Activity for the entire application and then
-overriding it with a {@code &lt;meta-data&gt;} element inside certain activities. (You might do
-this if you want to search different sets of data that cannot be handled by the same
-searchable Activity, depending on the currently open Activity.)</p>
 
 
 <h3 id="PerformingSearch">Performing a search</h3>
 
-<p>Once you have declared your searchable Activity, performing a search for the user involves
-three steps:</p>
+<p>Once you have declared your searchable activity in the manifest, performing a search in your
+searchable activity involves three steps:</p>
+
 <ol>
   <li><a href="#ReceivingTheQuery">Receiving the query</a></li>
   <li><a href="#SearchingYourData">Searching your data</a></li>
@@ -253,20 +283,19 @@ three steps:</p>
 </ol>
 
 <p>Traditionally, your search results should be presented in a {@link android.widget.ListView}, so
-you might want your searchable Activity to extend {@link android.app.ListActivity}, which
-provides easy access to {@link android.widget.ListView} APIs. (See the <a
-href="{@docRoot}resources/tutorials/views/hello-listview.html">List View Tutorial</a> for a simple
-{@link android.app.ListActivity} sample.)</p>
+you might want your searchable activity to extend {@link android.app.ListActivity}. It includes
+a default layout with a single {@link android.widget.ListView} and provides several
+convenience methods for working with the {@link android.widget.ListView}.</p>
 
 
 <h4 id="ReceivingTheQuery">Receiving the query</h4>
 
-<p>When a user executes a search from the search dialog, the Search Manager sends the {@link
-android.content.Intent#ACTION_SEARCH} {@link android.content.Intent} to your searchable Activity.
-This Intent carries the search query in the
+<p>When a user executes a search from the search dialog or widget, the system starts your
+searchable activity and sends it a {@link android.content.Intent#ACTION_SEARCH} intent. This intent
+carries the search query in the
 {@link android.app.SearchManager#QUERY QUERY} string extra. You must check for
-this Intent when the Activity starts and extract the string. For example, here's how you can get the
-query when your Activity starts:</p>
+this intent when the activity starts and extract the string. For example, here's how you can get the
+search query when your searchable activity starts:</p>
 
 <pre>
 &#64;Override
@@ -274,8 +303,8 @@ public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.search);
 
+    // Get the intent, verify the action and get the query
     Intent intent = getIntent();
-
     if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
       String query = intent.getStringExtra(SearchManager.QUERY);
       doMySearch(query);
@@ -284,7 +313,7 @@ public void onCreate(Bundle savedInstanceState) {
 </pre>
 
 <p>The {@link android.app.SearchManager#QUERY QUERY} string is always included with
-the {@link android.content.Intent#ACTION_SEARCH} Intent. In this example, the query is
+the {@link android.content.Intent#ACTION_SEARCH} intent. In this example, the query is
 retrieved and passed to a local {@code doMySearch()} method where the actual search operation
 is done.</p>
 
@@ -294,12 +323,13 @@ is done.</p>
 <p>The process of storing and searching your data is unique to your application.
 You can store and search your data in many ways, but this guide does not show you how to store your
 data and search it. Storing and searching your data is something you should carefully consider in
-terms of your needs and your data. However, here are some tips you might be able to apply:</p>
+terms of your needs and your data format. However, here are some tips you might be able to
+apply:</p>
 
   <ul>
     <li>If your data is stored in a SQLite database on the device, performing a full-text search
-(using FTS3, rather than a LIKE query) can provide a more robust search across text data and can
-produce results significantly faster. See <a href="http://sqlite.org/fts3.html">sqlite.org</a>
+(using FTS3, rather than a {@code LIKE} query) can provide a more robust search across text data and
+can produce results significantly faster. See <a href="http://sqlite.org/fts3.html">sqlite.org</a>
 for information about FTS3 and the {@link android.database.sqlite.SQLiteDatabase} class for
 information about SQLite on Android. Also look at the <a
 href="{@docRoot}resources/samples/SearchableDictionary/index.html">Searchable Dictionary</a> sample
@@ -307,43 +337,45 @@ application to see a complete SQLite implementation that performs searches with
     <li>If your data is stored online, then the perceived search performance might be
 inhibited by the user's data connection. You might want to display a spinning progress wheel until
 your search returns. See {@link android.net} for a reference of network APIs and <a
-href="{@docRoot}guide/topics/ui/dialogs.html#ProgressDialog">Creating a Progress Dialog</a> to see
-how you can display a progress wheel.</li>
+href="{@docRoot}guide/topics/ui/dialogs.html#ProgressDialog">Creating a Progress Dialog</a>
+for information about how to display a progress wheel.</li>
   </ul>
 
 
 <div class="sidebox-wrapper">
 <div class="sidebox">
 <h2>About Adapters</h2>
-<p>An Adapter binds individual items from a set of data into individual {@link
-android.view.View} objects. When the Adapter
-is applied to a {@link android.widget.ListView}, the Views are injected as individual items of the
-list. {@link
-android.widget.Adapter} is simply an interface, so implementations such as {@link
+<p>An {@link android.widget.Adapter} binds each item from a set of data into a
+{@link android.view.View} object. When the {@link android.widget.Adapter}
+is applied to a {@link android.widget.ListView}, each piece of data is inserted as an individual
+view into the list. {@link
+android.widget.Adapter} is just an interface, so implementations such as {@link
 android.widget.CursorAdapter} (for binding data from a {@link android.database.Cursor}) are needed.
-If none of the existing implementations work for your data, then you should implement your own from
+If none of the existing implementations work for your data, then you can implement your own from
 {@link android.widget.BaseAdapter}. Install the SDK Samples package for API Level 4 to see the
-original version of the Searchable Dictionary, which creates a custom BaseAdapter.</p>
+original version of the Searchable Dictionary, which creates a custom adapter to read data from
+a file.</p>
 </div>
 </div>
 
 <p>Regardless of where your data lives and how you search it, we recommend that you return search
-results to your searchable Activity with an {@link android.widget.Adapter}. This way, you can easily
+results to your searchable activity with an {@link android.widget.Adapter}. This way, you can easily
 present all the search results in a {@link android.widget.ListView}. If your data comes from a
-SQLite database query, then you can apply your results to a {@link android.widget.ListView}
+SQLite database query, you can apply your results to a {@link android.widget.ListView}
 using a {@link android.widget.CursorAdapter}. If your data comes in some other type of format, then
-you can create an extension of the {@link android.widget.BaseAdapter}.</p>
+you can create an extension of {@link android.widget.BaseAdapter}.</p>
+
 
 <h4 id="PresentingTheResults">Presenting the results</h4>
 
-<p>Presenting your search results is mostly a UI detail that is not handled by the search APIs.
-However, one option is to create your searchable Activity to extend {@link
-android.app.ListActivity} and call {@link
-android.app.ListActivity#setListAdapter(ListAdapter)}, passing it an {@link
+<p>As discussed above, the recommended UI for your search results is a {@link
+android.widget.ListView}, so you might want your searchable activity to extend {@link
+android.app.ListActivity}. You can then call {@link
+android.app.ListActivity#setListAdapter(ListAdapter) setListAdapter()}, passing it an {@link
 android.widget.Adapter} that is bound to your data. This injects all the
-results into the Activity {@link android.widget.ListView}.</p>
+search results into the activity {@link android.widget.ListView}.</p>
 
-<p>For more help presenting your results, see the {@link android.app.ListActivity}
+<p>For more help presenting your results in a list, see the {@link android.app.ListActivity}
 documentation.</p>
 
 <p>Also see the <a
@@ -353,22 +385,130 @@ for an a complete demonstration of how to search an SQLite database and use an
 
 
 
-<h2 id="InvokingTheSearchDialog">Invoking the Search Dialog</h2>
 
-<p>Once you have a searchable Activity, invoking the search dialog is easy. Many Android
-devices provide a dedicated SEARCH key, which reveals the search dialog when the user presses it
-from a searchable context of your application. However, you should not assume that a SEARCH
-key is available on the user's device and should always provide a search button in your UI that
-invokes search.</p>
 
-<p>To invoke search from your Activity, call {@link android.app.Activity#onSearchRequested()}.</p>
+<h2 id="SearchDialog">Using the Search Dialog</h2>
+
+<div class="sidebox-wrapper">
+<div class="sidebox">
+  <h2>Should I use the search dialog or the widget?</h2>
+  <p>The answer depends mostly on whether you are developing for Android 3.0 (API Level 11 or
+higher), because the {@link android.widget.SearchView} widget was introduced in Android 3.0. So,
+if you are developing your application for a version of Android lower than 3.0, the search widget is
+not an option and you should use the search dialog to implement your search interface.</p>
+  <p>If you <em>are</em> developing for Android 3.0 or higher, then the decision depends more on
+your needs. In most cases, we recommend that you use the search widget as an "action view" in the
+Action Bar. However, it might not be an option for you to put the search
+widget in the Action Bar for some reason (perhaps there's not enough space or you don't use the
+Action Bar). So, you might instead want to put the search widget somewhere in your activity layout.
+And if all else fails, you can still use the search dialog if you prefer to keep the search box
+hidden. In fact, you might want to offer both the dialog and the widget in some cases. For more
+information about the widget, skip to <a href="#UsingSearchWidget">Using the Search Widget</a>.</p>
+</div>
+</div>
+
+<p>The search dialog provides a floating search box at the top of the screen, with the application
+icon on the left. The search dialog can provide search suggestions as the user types and, when
+the user executes a search, the system sends the search query to a
+searchable activity that performs the search. However, if you are developing
+your application for devices running Android 3.0, you should consider using the search widget
+instead (see the side box).</p>
+
+<p>The search dialog is always hidden by default, until the user activates it. If the user's device
+includes a SEARCH button, pressing it will activate the search dialog by default. Your application
+can also activate the search dialog on demand by calling {@link
+android.app.Activity#onSearchRequested onSearchRequested()}. However, neither of these work
+until you enable the search dialog for the activity.</p>
+
+<p>To enable the search dialog, you must indicate to the system which searchable activity should
+receive search queries from the search dialog, in order to perform searches. For example, in the
+previous section about <a href="#SearchableActivity">Creating a Searchable Activity</a>, a
+searchable activity named {@code SearchableActivity} was created. If you want a separate activity,
+named {@code OtherActivity}, to show the search dialog and deliver searches to {@code
+SearchableActivity}, you must declare in the manifest that {@code SearchableActivity} is the
+searchable activity to use for the search dialog in {@code OtherActivity}.</p>
+
+<p>To declare the searchable activity for an activity's search dialog,
+add a <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data&gt;}</a>
+element inside the respective activity's <a
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a> element.
+The <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data&gt;}</a>
+element must include the {@code android:value} attribute that specifies the searchable activity's
+class name and the {@code android:name} attribute with a value of {@code
+"android.app.default_searchable"}.</p>
+
+<p>For example, here is the declaration for
+both a searchable activity, {@code SearchableActivity}, and another activity, {@code
+OtherActivity}, which uses {@code SearchableActivity} to perform searches executed from its
+search dialog:</p>
+
+<pre>
+&lt;application ... >
+    &lt;!-- this is the searchable activity; it performs searches --&gt;
+    &lt;activity android:name=".SearchableActivity" >
+        &lt;intent-filter>
+            &lt;action android:name="android.intent.action.SEARCH" />
+        &lt;/intent-filter>
+        &lt;meta-data android:name="android.app.searchable"
+                   android:resource="@xml/searchable"/>
+    &lt;/activity>
+
+    &lt;!-- this activity enables the search dialog to initiate searches
+         in the SearchableActivity --&gt;
+    &lt;activity android:name=".OtherActivity" ... >
+        &lt;!-- enable the search dialog to send searches to SearchableActivity -->
+        <b>&lt;meta-data android:name="android.app.default_searchable"
+                   android:value=".SearchableActivity" /&gt;</b>
+    &lt;/activity>
+    ...
+&lt;/application>
+</pre>
+
+<p>Because the {@code OtherActivity} now includes a <a
+href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data&gt;}</a>
+element to declare which searchable activity to use for searches, the activity has enabled the
+search dialog.
+While the user is in this activity, the device SEARCH button (if available) and the {@link
+android.app.Activity#onSearchRequested onSearchRequested()} method will activate the search dialog.
+When the user executes the search, the system starts {@code SearchableActivity} and delivers it
+the {@link android.content.Intent#ACTION_SEARCH} intent.</p>
+
+<p class="note"><strong>Note:</strong> The searchable activity itself provides the search dialog
+by default, so you don't need to add this declaration to {@code SearchableActivity}.</p>
+
+<p>If you want every activity in your application to provide the search dialog, insert the above <a
+href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data&gt;}</a>
+element as a child of the <a
+href="{@docRoot}guide/topics/manifest/application-element.html">{@code &lt;application&gt;}</a>
+element, instead of each <a
+href="{@docRoot}guide/topics/manifest/activity-element.html">{@code &lt;activity&gt;}</a>. This
+way, every activity inherits the value, provides the search dialog, and delivers searches to
+the same searchable activity. (If you have multiple searchable activities, you can override the
+default searchable activity by placing a different <a
+href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code &lt;meta-data&gt;}</a>
+declaration inside individual activities.)</p>
+
+<p>With the search dialog now enabled for your activities, your application is ready to perform
+searches.</p>
+
+
+<h3 id="InvokingTheSearchDialog">Invoking the search dialog</h3>
+
+<p>As mentioned above, the device SEARCH button and {@link android.app.Activity#onSearchRequested
+onSearchRequested()} method will open the search dialog, as long as the current activity
+has declared the searchable activity to use, as shown in the previous section.</p>
+
+<p>However, you should not assume that a SEARCH button is available on the user's device. You
+should always provide another search button in your UI that activates the search dialog by calling
+{@link android.app.Activity#onSearchRequested()}.</p>
 
-<p>For instance, you should provide a menu item in your <a
-href="{@docRoot}guide/topics/ui/menus.html#options-menu">Options Menu</a> or a button in your UI to
-invoke search with this method. The <a
+<p>For instance, you should either provide a menu item in your <a
+href="{@docRoot}guide/topics/ui/menus.html#options-menu">Options Menu</a> or a button in your
+activity layout that
+activates search by calling {@link android.app.Activity#onSearchRequested()}. The <a
 href="{@docRoot}shareables/search_icons.zip">search_icons.zip</a> file includes icons for
-medium and high density screens, which you can use for your search menu item or button (low density
-screens automatically scale-down the hdpi image by one half). </p>
+medium and high density screens, which you can use for your search menu item or button (low-density
+screens scale-down the hdpi image by one half). </p>
 
 <!-- ... maybe this should go into the Creating Menus document ....
 <p>If you chose to provide a shortcut key for the menu item,  using {@link
@@ -376,27 +516,28 @@ android.view.MenuItem#setAlphabeticShortcut(char)}, then SearchManager.MENU_KEY
 key character, representing the default search key.</p>
 -->
 
-<p>You can also enable "type-to-search" functionality, which reveals the search dialog when the
-user starts typing on the keyboard and the keystrokes are inserted into the search dialog. You can
-enable type-to-search in your Activity by calling
+<p>You can also enable "type-to-search" functionality, which activates the search dialog when the
+user starts typing on the keyboard&mdash;the keystrokes are inserted into the search dialog. You can
+enable type-to-search in your activity by calling
 {@link android.app.Activity#setDefaultKeyMode(int) setDefaultKeyMode}({@link
-android.app.Activity#DEFAULT_KEYS_SEARCH_LOCAL}) during your Activity's
+android.app.Activity#DEFAULT_KEYS_SEARCH_LOCAL}) during your activity's
 {@link android.app.Activity#onCreate(Bundle) onCreate()} method.</p>
 
 
-<h3 id="LifeCycle">The impact of the search dialog on your Activity lifecycle</h3>
+<h3 id="LifeCycle">The impact of the search dialog on your activity lifecycle</h3>
 
 <p>The search dialog is a {@link android.app.Dialog} that floats at the top of the
-screen. It does not cause any change in the Activity stack, so when the search dialog appears, no
-lifecycle methods for the currently open Activity (such as {@link
-android.app.Activity#onPause()}) are called. Your Activity just loses input focus as it is given to
-the search dialog.
+screen. It does not cause any change in the activity stack, so when the search dialog appears, no
+lifecycle methods (such as {@link android.app.Activity#onPause()}) are called. Your activity just
+loses input focus, as input focus is given to the search dialog.
 </p>
 
-<p>If you want to be notified when search is invoked, override the {@link
-android.app.Activity#onSearchRequested()} method. When the system calls this method, you can do any
-work you want to when your Activity looses input focus to the search dialog (such as pause
-animations). Unless you are <a href="#SearchContextData">passing search context data</a>
+<p>If you want to be notified when the search dialog is activated, override the {@link
+android.app.Activity#onSearchRequested()} method. When the system calls this method, it is an
+indication that your activity has lost input focus to the search dialog, so you can do any
+work appropriate for the event (such as pause
+a game). Unless you are <a
+href="#SearchContextData">passing search context data</a>
 (discussed below), you should end the method by calling the super class implementation. For
 example:</p>
 
@@ -408,8 +549,8 @@ public boolean onSearchRequested() {
 }
 </pre>
 
-<p>If the user cancels search by pressing the BACK key, the Activity in which search was
-invoked re-gains input focus. You can register to be notified when the search dialog is
+<p>If the user cancels search by pressing the BACK button, the search dialog closes and the activity
+regains input focus. You can register to be notified when the search dialog is
 closed with {@link android.app.SearchManager#setOnDismissListener(SearchManager.OnDismissListener)
 setOnDismissListener()}
 and/or {@link android.app.SearchManager#setOnCancelListener(SearchManager.OnCancelListener)
@@ -420,25 +561,26 @@ android.app.SearchManager.OnCancelListener OnCancelListener} only pertains to ev
 user explicitly exited the search dialog, so it is not called when a search is executed (in which
 case, the search dialog naturally disappears).</p>
 
-<p>If the current Activity is not the searchable Activity, then the normal Activity lifecycle
-events are triggered once the user executes a search (the current Activity receives {@link
+<p>If the current activity is not the searchable activity, then the normal activity lifecycle
+events are triggered once the user executes a search (the current activity receives {@link
 android.app.Activity#onPause()} and so forth, as
-described in <a href="{@docRoot}guide/topics/fundamentals/activities.html#Lifecycle">Activities</a>
-document). If, however, the current Activity is the searchable Activity, then one of two
+described in the <a
+href="{@docRoot}guide/topics/fundamentals/activities.html#Lifecycle">Activities</a>
+document). If, however, the current activity is the searchable activity, then one of two
 things happens:</p>
 
 <ol type="a">
-  <li>By default, the searchable Activity receives the {@link
-android.content.Intent#ACTION_SEARCH} Intent with a call to {@link
+  <li>By default, the searchable activity receives the {@link
+android.content.Intent#ACTION_SEARCH} intent with a call to {@link
 android.app.Activity#onCreate(Bundle) onCreate()} and a new instance of the
-Activity is brought to the top of the Activity stack. There are now two instances of your
-searchable Activity in the Activity stack (so pressing the BACK key goes back to the previous
-instance of the searchable Activity, rather than exiting the searchable Activity).</li>
-  <li>If you set {@code android:launchMode} to "singleTop", then the
-searchable Activity receives the {@link android.content.Intent#ACTION_SEARCH} Intent with a call
+activity is brought to the top of the activity stack. There are now two instances of your
+searchable activity in the activity stack (so pressing the BACK button goes back to the previous
+instance of the searchable activity, rather than exiting the searchable activity).</li>
+  <li>If you set {@code android:launchMode} to <code>"singleTop"</code>, then the
+searchable activity receives the {@link android.content.Intent#ACTION_SEARCH} intent with a call
 to {@link android.app.Activity#onNewIntent(Intent)}, passing the new {@link
-android.content.Intent#ACTION_SEARCH} Intent here. For example, here's how you might handle
-this case, in which the searchable Activity's launch mode is "singleTop":
+android.content.Intent#ACTION_SEARCH} intent here. For example, here's how you might handle
+this case, in which the searchable activity's launch mode is <code>"singleTop"</code>:
 <pre>
 &#64;Override
 public void onCreate(Bundle savedInstanceState) {
@@ -463,29 +605,29 @@ private void handleIntent(Intent intent) {
 
 <p>Compared to the example code in the section about <a href="#PerformingSearch">Performing a
 Search</a>, all the code to handle the
-search Intent is now in the {@code handleIntent()} method, so that both {@link
+search intent is now in the {@code handleIntent()} method, so that both {@link
 android.app.Activity#onCreate(Bundle)
 onCreate()} and {@link android.app.Activity#onNewIntent(Intent) onNewIntent()} can execute it.</p>
 
-<p>When the system calls {@link android.app.Activity#onNewIntent(Intent)}, the Activity has
+<p>When the system calls {@link android.app.Activity#onNewIntent(Intent)}, the activity has
 not been restarted, so the {@link android.app.Activity#getIntent()} method
-returns the same Intent that was received with {@link
+returns the same intent that was received with {@link
 android.app.Activity#onCreate(Bundle) onCreate()}. This is why you should call {@link
 android.app.Activity#setIntent(Intent)} inside {@link
-android.app.Activity#onNewIntent(Intent)} (so that the Intent saved by the Activity is updated in
+android.app.Activity#onNewIntent(Intent)} (so that the intent saved by the activity is updated in
 case you call {@link android.app.Activity#getIntent()} in the future).</p>
 
 </li>
 </ol>
 
-<p>The second scenario using "singleTop" launch mode is usually ideal, because chances are good that
-once a search is done, the user will perform additional searches and it's a bad experience if your
-application creates multiple instances of the searchable Activity. So, we recommend that you set
-your searchable Activity to "singleTop" launch mode in the application
-manifest. For example:</p>
+<p>The second scenario using <code>"singleTop"</code> launch mode is usually ideal, because chances
+are good that once a search is done, the user will perform additional searches and it's a bad
+experience if your application creates multiple instances of the searchable activity. So, we
+recommend that you set your searchable activity to <code>"singleTop"</code> launch mode in the
+application manifest. For example:</p>
 
 <pre>
-&lt;activity android:name=".MySearchableActivity"
+&lt;activity android:name=".SearchableActivity"
           <b>android:launchMode="singleTop"</b> >
     &lt;intent-filter>
         &lt;action android:name="android.intent.action.SEARCH" />
@@ -497,57 +639,192 @@ manifest. For example:</p>
 
 
 
-<h2 id="SearchContextData">Passing Search Context Data</h2>
+<h3 id="SearchContextData">Passing search context data</h3>
 
-<p>To refine your search criteria from the current Activity instead of depending only on the user's
-search query, you can provide additional data in the Intent that the Search Manager sends to your
-searchable Activity. In a simple case, you can make your refinements inside the searchable
-Activity, for every search made, but if your
-search criteria varies from one searchable context to another, then you can pass whatever data
-is necessary to refine your search in the {@link android.app.SearchManager#APP_DATA} {@link
-android.os.Bundle}, which is included in the {@link android.content.Intent#ACTION_SEARCH}
-Intent.</p>
+<p>In some cases, you can make necessary refinements to the search query inside the searchable
+activity, for every search made. However, if you want to refine your search criteria based on the
+activity from which the user is performing a search, you can provide additional data in the intent
+that the system sends to your searchable activity. You can pass the additional data in the {@link
+android.app.SearchManager#APP_DATA} {@link android.os.Bundle}, which is included in the {@link
+android.content.Intent#ACTION_SEARCH} intent.</p>
 
-<p>To pass this kind of data to your searchable Activity, override  {@link
-android.app.Activity#onSearchRequested()} method for the Activity in which search can be invoked.
+<p>To pass this kind of data to your searchable activity, override the {@link
+android.app.Activity#onSearchRequested()} method for the activity from which the user can perform a
+search, create a {@link android.os.Bundle} with the additional data, and call {@link
+android.app.Activity#startSearch startSearch()} to activate the search dialog.
 For example:</p>
 
 <pre>
 &#64;Override
 public boolean onSearchRequested() {
      Bundle appData = new Bundle();
-     appData.putBoolean(MySearchableActivity.JARGON, true);
+     appData.putBoolean(SearchableActivity.JARGON, true);
      startSearch(null, false, appData, false);
      return true;
  }
 </pre>
 
-<p>Returning "true" indicates that you have successfully handled this callback event. Then in your
-searchable Activity, you can extract the data placed inside {@code appdata} from the {@link
+<p>Returning "true" indicates that you have successfully handled this callback event and
+called {@link android.app.Activity#startSearch startSearch()} to activate
+the search dialog. Once the user submits a query, it's delivered to your
+searchable activity along with the data you've added. You can extract the extra data from the {@link
 android.app.SearchManager#APP_DATA} {@link android.os.Bundle} to refine the search. For example:</p>
 
 <pre>
 Bundle appData = getIntent().getBundleExtra(SearchManager.APP_DATA);
 if (appData != null) {
-    boolean jargon = appData.getBoolean(MySearchableActivity.JARGON);
+    boolean jargon = appData.getBoolean(SearchableActivity.JARGON);
 }
 </pre>
 
 <p class="caution"><strong>Caution:</strong> Never call the {@link
 android.app.Activity#startSearch(String,boolean,Bundle,boolean) startSearch()} method from outside
-the {@link android.app.Activity#onSearchRequested()} callback method. To invoke the search dialog
-in your Activity, always call {@link android.app.Activity#onSearchRequested()}. Otherwise, {@link
+the {@link android.app.Activity#onSearchRequested()} callback method. To activate the search dialog
+in your activity, always call {@link android.app.Activity#onSearchRequested()}. Otherwise, {@link
 android.app.Activity#onSearchRequested()} is not called and customizations (such as the addition of
 {@code appData} in the above example) are missed.</p>
 
 
+
+<h2 id="UsingSearchWidget">Using the Search Widget</h2>
+
+<div class="figure" style="width:429px;margin:0">
+  <img src="{@docRoot}images/ui/actionbar-actionview.png" alt="" />
+  <p class="img-caption"><strong>Figure 2.</strong> The {@link
+android.widget.SearchView} widget as an "action view" in the Action Bar.</p>
+</div>
+
+<p>The {@link android.widget.SearchView} widget is available in Android 3.0 and higher. If
+you're developing your application for Android 3.0 and have decided to use the search widget, we
+recommend that you insert the search widget as an <a
+href="{@docRoot}guide/topics/ui/actionbar.html#ActionView">action view in the Action Bar</a>,
+instead of using the search dialog (and instead of placing the search widget in your activity
+layout). For example, figure 2 shows the search widget in the Action Bar.</p>
+
+<p>The search widget provides the same functionality as the search dialog. It starts the appropriate
+activity when the user executes a search, and it can provide search suggestions and perform voice
+search.</p>
+
+<p class="note"><strong>Note:</strong> When you use the search widget as an action view, you
+still might need to support using the search dialog, for cases in which the search widget does
+not fit in the Action Bar. See the following section about <a href="#UsingBoth">Using both
+the widget and the dialog</a>.</p>
+
+
+<h3 id="ConfiguringWidget">Configuring the search widget</h3>
+
+<p>After you've created a  <a href="#SearchableConfiguration">searchable configuration</a> and a <a
+href="#SearchableActivity">searchable activity</a>, as discussed above, you need to enable assisted
+search for each {@link android.widget.SearchView}. You can do so by calling {@link
+android.widget.SearchView#setSearchableInfo setSearchableInfo()} and passing it the {@link
+android.app.SearchableInfo} object that represents your searchable configuration.</p>
+
+<p>You can get a reference to the {@link android.app.SearchableInfo} by calling {@link
+android.app.SearchManager#getSearchableInfo getSearchableInfo()} on {@link
+android.app.SearchManager}.</p>
+
+<p>For example, if you're using a {@link android.widget.SearchView} as an action view in the <a
+href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a>, you should enable the widget
+during the {@link android.app.Activity#onCreateOptionsMenu onCreateOptionsMenu()} callback:</p>
+
+<pre>
+&#64;Override
+public boolean onCreateOptionsMenu(Menu menu) {
+    // Inflate the options menu from XML
+    MenuInflater inflater = getMenuInflater();
+    inflater.inflate(R.menu.options_menu, menu);
+
+    // Get the SearchView and set the searchable configuration
+    SearchManager searchManager = (SearchManager) {@link android.app.Activity#getSystemService getSystemService}(Context.SEARCH_SERVICE);
+    SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
+    searchView.setSearchableInfo(searchManager.getSearchableInfo({@link android.app.Activity#getComponentName()}));
+    searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default
+
+    return true;
+}
+</pre>
+
+<p>That's all you need. The search widget is now configured and the system will deliver search
+queries to your searchable activity. You can also enable <a href="#SearchSuggestions">search
+suggestions</a> for the search widget.</p>
+
+<p class="note"><strong>Note:</strong> If you want to handle all user input yourself, you can do so
+with some callback methods and event listeners. For more information, see the reference
+documentation for {@link android.widget.SearchView} and its nested interfaces for the
+appropriate event listeners.</p>
+
+<p>For more information about action views in the Action Bar, read <a
+href="{@docRoot}guide/topics/ui/actionbar.html#ActionView">Using the Action Bar</a> (which
+includes sample code for adding a search widget as an action view).</p>
+
+
+<h3 id="WidgetFeatures">Other search widget features</h3>
+
+<p>The {@link android.widget.SearchView} widget allows for a few additional features you might
+want:</p>
+
+<dl>
+  <dt>A submit button</dt>
+  <dd>By default, there's no button to submit a search query, so the user must press the
+"Return" key on the keyboard to initiate a search. You can add a "submit" button by calling
+{@link android.widget.SearchView#setSubmitButtonEnabled setSubmitButtonEnabled(true)}.</dd>
+  <dt>Query refinement for search suggestions</dt>
+  <dd>When you've enabled search suggestions, you usually expect users to simply select a
+suggestion, but they might also want to refine the suggested search query. You can add a button
+alongside each suggestion that inserts the suggestion in the search box for refinement by the
+user, by calling {@link android.widget.SearchView#setQueryRefinementEnabled
+setQueryRefinementEnabled(true)}.</dd>
+  <dt>The ability to toggle the search box visibility</dt>
+  <dd>By default, the search widget is "iconified," meaning that it is represented only by a
+search icon (a magnifying glass), and expands to show the search box when the user touches it.
+As shown above, you can show the search box by default, by calling {@link
+android.widget.SearchView#setIconifiedByDefault setIconifiedByDefault(false)}. You can also
+toggle the search widget appearance by calling {@link android.widget.SearchView#setIconified
+setIconified()}.</dd>
+</dl>
+
+<p>There are several other APIs in the {@link android.widget.SearchView} class that allow you to
+customize the search widget. However, most of them are used only when you handle all
+user input yourself, instead of using the Android system to deliver search queries and display
+search suggestions.</p>
+
+
+<h3 id="UsingBoth">Using both the widget and the dialog</h3>
+
+<p>If you insert the search widget in the Action Bar as an <a
+href="{@docRoot}guide/topics/ui/actionbar.html#ActionView">action view</a>, and you enable it to
+appear in the Action Bar "if there is room" (by setting {@code
+android:showAsAction="ifRoom"}), then there is a chance that the search widget will not appear
+as an action view, but the menu item will appear in the overflow menu. For example, when your
+application runs on a smaller screen, there might not be enough room in the Action Bar to display
+the search widget along with other action items or navigation elements, so the menu item will
+instead appear in the overflow menu. When placed in the overflow menu, the item works like an
+ordinary menu item and does not display the action view (the search widget).</p>
+
+<p>To handle this situation, the menu item to which you've attached the search widget should
+activate the search dialog when the user selects it from the overflow menu. In order for it to do
+so, you must implement {@link android.app.Activity#onOptionsItemSelected onOptionsItemSelected()} to
+handle the "Search" menu item and open the search dialog by calling {@link
+android.app.Activity#onSearchRequested onSearchRequested()}.</p>
+
+<p>For more information about how items in the Action Bar work and how to handle this situation, see
+the documentation for <a href="{@docRoot}guide/topics/ui/actionbar.html">Using the Action
+Bar</a>.</p>
+
+<p>Also see the <a
+href="{@docRoot}resources/samples/SearchableDictionary/src/com/example/android/searchabledict/
+SearchableDictionary.html">Searchable Dictionary</a> for an example implementation using
+both the dialog and the widget.</p>
+
+
+
 <h2 id="VoiceSearch">Adding Voice Search</h2>
 
-<p>You can add voice search functionality to your search dialog by adding the {@code
+<p>You can add voice search functionality to your search dialog or widget by adding the {@code
 android:voiceSearchMode} attribute to your searchable configuration. This adds a voice search
-button in the search dialog that launches a voice prompt. When the user
+button that launches a voice prompt. When the user
 has finished speaking, the transcribed search query is sent to your searchable
-Activity.</p>
+activity.</p>
 
 <p>For example:</p>
 
@@ -562,7 +839,7 @@ Activity.</p>
 
 <p>The value {@code showVoiceSearchButton} is required to enable voice
 search, while the second value, {@code launchRecognizer}, specifies that the voice search button
-should launch a recognizer that returns the transcribed text to the searchable Activity.</p>
+should launch a recognizer that returns the transcribed text to the searchable activity.</p>
 
 <p>You can provide additional attributes to specify the voice search behavior, such
 as the language to be expected and the maximum number of results to return. See the <a
@@ -571,6 +848,38 @@ available attributes.</p>
 
 <p class="note"><strong>Note:</strong> Carefully consider whether voice search is appropriate for
 your application. All searches performed with the voice search button are immediately sent to
-your searchable Activity without a chance for the user to review the transcribed query. Sufficiently
+your searchable activity without a chance for the user to review the transcribed query. Sufficiently
 test the voice recognition and ensure that it understands the types of queries that
 the user might submit inside your application.</p>
+
+
+
+<h2 id="SearchSuggestions">Adding Search Suggestions</h2>
+
+<div class="figure" style="width:250px;margin:0">
+<img src="{@docRoot}images/search/search-suggest-custom.png" alt="" height="417" />
+<p class="img-caption"><strong>Figure 3.</strong> Screenshot of a search dialog with custom
+search suggestions.</p>
+</div>
+
+<p>Both the search dialog and the search widget can provide search suggestions as the user
+types, with assistance from the Android system. The system manages the list of suggestions and
+handles the event when the user selects a suggestion.</p>
+
+<p>You can provide two kinds of search suggestions:</p>
+
+<dl>
+  <dt>Recent query search suggestions</dt>
+  <dd>These suggestions are simply words that the user previously used as search queries in
+your application.
+  <p>See <a href="adding-recent-query-suggestions.html">Adding Recent Query
+Suggestions</a>.</p></dd>
+  <dt>Custom search suggestions</dt>
+  <dd>These are search suggestions that you provide from your own data source, to help users
+immediately select the correct spelling or item they are searching for. Figure 3 shows an
+example of custom suggestions for a dictionary application&mdash;the user can select a suggestion
+to instantly go to the definition.
+  <p>See <a href="adding-custom-suggestions.html">Adding Custom
+Suggestions</a></p></dd>
+</dl>
+
index 2aa2db6..fb689f9 100644 (file)
@@ -7,19 +7,20 @@ parent.link=index.html
 <div id="qv">
 <h2>See also</h2>
 <ol>
-  <li><a href="search-dialog.html">Using the Android Search Dialog</a></li>
+  <li><a href="search-dialog.html">Creating a Search Interface</a></li>
   <li><a href="adding-recent-query-suggestions.html">Adding Recent Query Suggestions</a></li>
   <li><a href="adding-custom-suggestions.html">Adding Custom Suggestions</a></li>
 </ol>
 </div>
 </div>
 
-<p>To utilize the Android search framework and provide a custom search dialog, your
-application must provide a search
-configuration in the form of an XML resource. This document describes the search configuration XML
-in terms of its syntax and usage. For more information about how to implement search
-features for your application, see the developer guide about <a
-href="index.html">Search</a>.</p>
+<p>In order to implement search with assistance from the Android system (to deliver search queries
+to an activity and provide search suggestions), your application must provide a search configuration
+in the form of an XML file.</p>
+
+<p>This page describes the search configuration file in terms of its syntax and usage. For more
+information about how to implement search features for your application, begin with the developer
+guide about <a href="search-dialog.html">Creating a Search Interface</a>.</p>
 
 <dl class="xml">
 
@@ -66,7 +67,7 @@ Android uses the filename as the resource ID.</dd>
 <dd>
 <dl class="tag-list">
   <dt id="searchable-element"><code>&lt;searchable&gt;</code></dt>
-  <dd>Defines all search configurations used with the search dialog.
+  <dd>Defines all search configurations used by the Android system to provide assisted search.
     <p class="caps">attributes:</p>
       <dl class="atn-list">
       <dt><code>android:label</code></dt>
@@ -86,21 +87,21 @@ string for {@code android:hint} as "Search <em>&lt;content-or-product&gt;</em>".
 "Search songs and artists" or "Search YouTube".</dd>
 
       <dt><code>android:searchMode</code></dt>
-      <dd><em>Keyword</em>. Sets additional modes that control the search dialog presentation.
-Currently available modes define how the query text that appears in the search dialog
-should be rewritten when a custom suggestion receives focus. The following mode values are accepted:
+      <dd><em>Keyword</em>. Sets additional modes that control the search presentation.
+Currently available modes define how the query text should be rewritten when a custom suggestion
+receives focus. The following mode values are accepted:
         <table>
           <tr><th>Value</th><th>Description</th></tr>
           <tr>
             <td><code>"queryRewriteFromText"</code></td>
             <td>Use the value from the {@link android.app.SearchManager#SUGGEST_COLUMN_TEXT_1}
-colum to rewrite the query text in the search dialog.</td>
+column to rewrite the query text.</td>
           </tr>
           <tr>
             <td><code>"queryRewriteFromData"</code></td>
             <td>Use the value from the
             {@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_DATA} column to rewrite the
-query text in the search dialog. This should only be used when the values in
+query text. This should only be used when the values in
             {@link android.app.SearchManager#SUGGEST_COLUMN_INTENT_DATA} are suitable for user
 inspection and editing, typically HTTP URI's.</td>
           </tr>
@@ -117,7 +118,7 @@ behavior is something other than a search (such as a URL request in a web browse
 
       <dt><code>android:inputType</code></dt>
       <dd><em>Keyword</em>. Defines the type of input method (such as the type of soft keyboard)
-to use with the search dialog. For most searches, in which free-form text is expected, you don't 
+to use. For most searches, in which free-form text is expected, you don't 
 need this attribute. See {@link android.R.attr#inputType} for a list of suitable values for this
 attribute.</dd>
 
@@ -161,14 +162,14 @@ can also use any non-null value to trigger the delivery of the query text via th
 selectionArgs} parameter (and then ignore the {@code selection} parameter).</dd>
 
       <dt><code>android:searchSuggestIntentAction</code></dt>
-        <dd><em>String</em>. The default Intent action to be used when a user
+        <dd><em>String</em>. The default intent action to be used when a user
         clicks on a custom search suggestion (such as {@code "android.intent.action.VIEW"}).
         If this is not overridden by the selected suggestion (via the {@link
 android.app.SearchManager#SUGGEST_COLUMN_INTENT_ACTION} column), this value is placed in the action
 field of the {@link android.content.Intent} when the user clicks a suggestion.</dd>
 
       <dt><code>android:searchSuggestIntentData</code></dt>
-        <dd><em>String</em>. The default Intent data to be used when a user
+        <dd><em>String</em>. The default intent data to be used when a user
         clicks on a custom search suggestion.
         If not overridden by the selected suggestion (via the {@link
 android.app.SearchManager#SUGGEST_COLUMN_INTENT_DATA} column), this value is
@@ -177,7 +178,7 @@ android.app.SearchManager#SUGGEST_COLUMN_INTENT_DATA} column), this value is
 
       <dt><code>android:searchSuggestThreshold</code></dt>
         <dd><em>Integer</em>. The minimum number of characters needed to
-        trigger a suggestion look-up. Only guarantees that the Search Manager will not query your
+        trigger a suggestion look-up. Only guarantees that the system will not query your
         content provider for anything shorter than the threshold. The default value is 0.</dd>
       </dl>
 
@@ -210,20 +211,21 @@ albums, and tracks" for a music application, or "Saved notes" for a notepad appl
         supersets of queries that have returned zero results in the past. For example, if
 your content provider returned zero results for "bo", it should be requiried for "bob". If set to
 "false", supersets are ignored for a single session ("bob" does not invoke a requery). This lasts
-only for the life of the search dialog (when the search dialog is reopened, "bo" queries your
+only for the life of the search dialog or the life of the activity when using the search widget
+(when the search dialog or activity is reopened, "bo" queries your
 content provider again). The default value is false.</dd>
       </dl>
 
 
     <h4>Voice search attributes</h4>
 
-    <p>To enable voice search for your search dialog, you'll need some of the
+    <p>To enable voice search, you'll need some of the
     following {@code &lt;searchable>} attributes:</p><br/>
 
       <dl class="atn-list">
         <dt><code>android:voiceSearchMode</code></dt>
         <dd><em>Keyword</em>. (Required to provide voice search capabilities.)
-          Enables voice search for the search dialog, with a specific mode for voice search.
+          Enables voice search, with a specific mode for voice search.
           (Voice search may not be provided by the device, in which case these flags
           have no effect.) The following mode values are accepted:
           <table>
@@ -238,14 +240,14 @@ then either {@code "launchWebSearch"} or {@code "launchRecognizer"} must also be
               <td><code>"launchWebSearch"</code></td>
               <td>The voice search button takes the user directly
               to a built-in voice web search activity. Most applications don't need this flag, as
-              it takes the user away from the Activity in which search was invoked.</td>
+              it takes the user away from the activity in which search was invoked.</td>
             </tr>
             <tr>
               <td><code>"launchRecognizer"</code></td>
               <td>The voice search button takes
-              the user directly to a built-in voice recording activity. This Activity
+              the user directly to a built-in voice recording activity. This activity
               prompts the user to speak, transcribes the spoken text, and forwards the resulting
-              query text to the searchable Activity, just as if the user typed it into the
+              query text to the searchable activity, just as if the user typed it into the
               search UI and clicked the search button.</td>
             </tr>
           </table>
@@ -283,9 +285,9 @@ java.util.Locale#getDefault() Locale.getDefault()}.</dd>
         <dt><code>android:voiceMaxResults</code></dt>
           <dd><em>Integer</em>. Forces the maximum number of results to return,
           including the "best" result which is always provided as the {@link
-android.content.Intent#ACTION_SEARCH} Intent's primary
+android.content.Intent#ACTION_SEARCH} intent's primary
           query. Must be 1 or greater. Use {@link android.speech.RecognizerIntent#EXTRA_RESULTS} to
-get the results from the Intent.
+get the results from the intent.
           If not provided, the recognizer chooses how many results to return.</dd>
       </dl>
   </dd> <!-- end searchable element -->
@@ -311,8 +313,8 @@ other three attributes in order to define the search action.</p>
         <dd><em>String</em>. (Required.) A key code from {@link
 android.view.KeyEvent} that represents the action key
         you wish to respond to (for example {@code "KEYCODE_CALL"}). This is added to the
-        {@link android.content.Intent#ACTION_SEARCH ACTION_SEARCH} Intent that is passed to your
-        searchable Activity. To examine the key code, use
+        {@link android.content.Intent#ACTION_SEARCH ACTION_SEARCH} intent that is passed to your
+        searchable activity. To examine the key code, use
         {@link android.content.Intent#getIntExtra getIntExtra(SearchManager.ACTION_KEY)}. Not all
 keys are supported for a search action, as many of them are used for typing, navigation, or system
 functions.</dd>
@@ -320,15 +322,15 @@ functions.</dd>
       <dt><code>android:queryActionMsg</code></dt>
         <dd><em>String</em>. An action message to be sent if the action key is pressed while the
 user is entering query text. This is added to the
-        {@link android.content.Intent#ACTION_SEARCH ACTION_SEARCH} Intent that the Search Manager
-        passes to your searchable Activity. To examine the string, use
+        {@link android.content.Intent#ACTION_SEARCH ACTION_SEARCH} intent that the system
+        passes to your searchable activity. To examine the string, use
         {@link android.content.Intent#getStringExtra
         getStringExtra(SearchManager.ACTION_MSG)}.</dd>
 
       <dt><code>android:suggestActionMsg</code></dt>
         <dd><em>String</em>. An action message to be sent if the action key is pressed while a
         suggestion is in focus. This is added to the
-        Intent that that the Search Manager passes to your searchable Activity (using the action
+        intent that that the system passes to your searchable activity (using the action
 you've defined for the suggestion). To examine the string,
         use {@link android.content.Intent#getStringExtra 
         getStringExtra(SearchManager.ACTION_MSG)}. This should only be used if all your
@@ -344,10 +346,10 @@ android:suggestActionMsg} attribute to define the action message for all suggest
 your content provider provides its own action message.
         <p>First, you must define a column in your
 content provider for each suggestion to provide an action message, then provide the name of that
-column in this attribute. The Search Manager looks at your suggestion cursor,
+column in this attribute. The system looks at your suggestion cursor,
         using the string provided here to select your action message column, and
         then select the action message string from the Cursor. That string is added to the
-        Intent that the Search Manager passes to your searchable Activity (using the action you've
+        intent that the system passes to your searchable activity (using the action you've
 defined for suggestions). To examine the string, use {@link
 android.content.Intent#getStringExtra getStringExtra(SearchManager.ACTION_MSG)}. If the data
 does not exist for the selected suggestion, the action key is ignored.</dd>
index 065f95a..d8898ae 100644 (file)
@@ -323,8 +323,7 @@ the item is enabled as an action item.</p>
 
 <p>When adding an action view for a menu item, it's important that you still allow the item to
 behave as a normal menu item when it does not appear in the Action Bar. For example, a menu item to
-perform a search should, by default, bring up the <a
-href="{@docRoot}guide/topics/search/search-dialog.html">search dialog</a>, but if the item is
+perform a search should, by default, bring up the Android search dialog, but if the item is
 placed in the Action Bar, the action view appears with a {@link android.widget.SearchView}
 widget. Figure 4 shows an example of  the {@link android.widget.SearchView} widget in an action
 view.</p>
@@ -369,9 +368,7 @@ always appear as an action view by setting {@code android:showAsAction} to {@cod
 <p>Now, when the menu item is displayed as an action item, it's action view appears instead of
 the icon and/or title text. However, if there's not enough room in the Action Bar, the item appears
 in the overflow menu as a normal menu item and you must respond to it from the {@link
-android.app.Activity#onOptionsItemSelected onOptionsItemSelected()} callback method. (For a
-guide to providing search functionality, see the <a
-href="{@docRoot}guide/topics/search/index.html">Search</a> documentation.)</p>
+android.app.Activity#onOptionsItemSelected onOptionsItemSelected()} callback method.</p>
 
 <p>When the activity first starts, the system populates the Action Bar and overflow menu by calling
 {@link android.app.Activity#onCreateOptionsMenu onCreateOptionsMenu()}.
@@ -392,8 +389,8 @@ public boolean onCreateOptionsMenu(Menu menu) {
 }
 </pre>
 
-<p>For more information about enabling search in the Action Bar, see the <a
-href="{@docRoot}guide/topics/search/index.html">Search</a> developer guide.</p>
+<p>For more information about using the search widget, see <a
+href="{@docRoot}guide/topics/search/search-dialog.html">Creating a Search Interface</a>.</p>
 
 
 
index 6c087bb..f88c3a6 100644 (file)
@@ -556,11 +556,10 @@ keyboard) is visible, the popup does not overlap the IME it until the user touch
 menu.</p></li>
     
     <li>{@link android.widget.SearchView}
-    <p>Provides a search box that works in conjunction with the Search Manager (in the same manner
-as the traditional <a href="{@docRoot}guide/topics/search/search-dialog.html">search dialog</a>). It
-can also display recent query suggestions or custom suggestions as configured by the search
-provider. This widget is particularly useful for offering search in the <a
-href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a>.</p></li>
+    <p>Provides a search box that you can configure to deliver search queries to a specified
+activity and display search suggestions (in the same manner as the traditional search dialog). This
+widget is particularly useful for offering a search widget in the Action Bar. For more information,
+see <a href="{@docRoot}guide/topics/search/search-dialog.html">Creating a Search Interface</p>.</li>
     
     <li>{@link android.widget.StackView}
     <p>A view that displays its children in a 3D stack and allows users to swipe through